Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)

This commit is contained in:
Kevin Papst
2022-12-31 21:19:55 +01:00
committed by GitHub
parent 95e06746bd
commit 90a0fd8a22
2164 changed files with 83700 additions and 86426 deletions

View File

@@ -9,73 +9,44 @@
namespace App\Form\Model;
use App\Form\Type\YesNoType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Validator\Constraint;
final class Configuration
{
/**
* @var string
*/
private $name;
/**
* @var string|null
*/
private $label;
/**
* @var string
*/
private $translationDomain = 'messages';
/**
* @var mixed
*/
private $value;
/**
* @var string
*/
private $type;
/**
* @var array
*/
private $options = [];
/**
* @var bool
*/
private $enabled = true;
/**
* @var bool
*/
private $required = true;
private ?string $label = null;
private string $translationDomain = 'messages';
private string|int|null|bool|array $value = null;
private ?string $type = null;
private array $options = [];
private bool $enabled = true;
private bool $required = true;
/**
* @var Constraint[]
*/
private $constraints = [];
private array $constraints = [];
public function getName(): ?string
public function __construct(private string $name)
{
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): Configuration
{
$this->name = $name;
return $this;
}
/**
* @return mixed
*/
public function getValue()
public function getValue(): string|int|null|bool|object
{
return $this->value;
}
/**
* @param mixed $value
* @return Configuration
*/
public function setValue($value): Configuration
public function setValue(string|int|null|bool|object $value): Configuration
{
if ($this->type === CheckboxType::class || $this->type === YesNoType::class) {
$value = (bool) $value;
}
$this->value = $value;
return $this;

View File

@@ -13,13 +13,11 @@ use DateTime;
final class DateRange
{
private $resetTimes;
private $begin;
private $end;
private ?DateTime $begin = null;
private ?DateTime $end = null;
public function __construct(bool $resetTimes = true)
public function __construct(private bool $resetTimes = true)
{
$this->resetTimes = $resetTimes;
}
public function getBegin(): ?DateTime

View File

@@ -12,22 +12,21 @@ namespace App\Form\Model;
use App\Entity\Team;
use App\Entity\Timesheet;
use App\Entity\User;
use App\Validator\Constraints as Constraints;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* @App\Validator\Constraints\TimesheetMultiUser
*/
#[Constraints\TimesheetMultiUser]
final class MultiUserTimesheet extends Timesheet
{
/**
* @var Collection<User>
*/
private $users;
private Collection $users;
/**
* @var Collection<Team>
*/
private $teams;
private Collection $teams;
public function __construct()
{
@@ -44,20 +43,16 @@ final class MultiUserTimesheet extends Timesheet
return $this->users;
}
public function addUser(User $user)
public function addUser(User $user): void
{
$this->users->add($user);
return $this;
}
public function removeUser(User $user)
public function removeUser(User $user): void
{
if ($this->users->contains($user)) {
$this->users->remove($user);
}
return $this;
}
/**
@@ -68,19 +63,15 @@ final class MultiUserTimesheet extends Timesheet
return $this->teams;
}
public function addTeam(Team $team)
public function addTeam(Team $team): void
{
$this->teams->add($team);
return $this;
}
public function removeTeam(Team $team)
public function removeTeam(Team $team): void
{
if ($this->teams->contains($team)) {
$this->teams->remove($team);
}
return $this;
}
}

View File

@@ -11,47 +11,15 @@ namespace App\Form\Model;
final class SystemConfiguration
{
/** @deprecated since 1.16.10 */
public const SECTION_ROUNDING = 'rounding';
/** @deprecated since 1.16.10 */
public const SECTION_LOCKDOWN = 'lockdown_period';
/** @deprecated since 1.16.10 */
public const SECTION_TIMESHEET = 'timesheet';
/** @deprecated since 1.16.10 */
public const SECTION_FORM_INVOICE = 'invoice';
/** @deprecated since 1.16.10 */
public const SECTION_FORM_CUSTOMER = 'customer';
/** @deprecated since 1.16.10 */
public const SECTION_FORM_USER = 'user';
/** @deprecated since 1.16.10 */
public const SECTION_THEME = 'theme';
/** @deprecated since 1.16.10 */
public const SECTION_AUTHENTICATION = 'authentication';
/** @deprecated since 1.16.10 */
public const SECTION_CALENDAR = 'calendar';
/** @deprecated since 1.16.10 */
public const SECTION_BRANDING = 'branding';
/**
* @var string|null
*/
private $section;
/**
* @var string|null
*/
private $translation;
/**
* @var string|null
*/
private $translationDomain = 'system-configuration';
private ?string $translation = null;
private string $translationDomain = 'system-configuration';
/**
* @var Configuration[]
*/
private $configuration = [];
private array $configuration = [];
public function __construct(?string $section = null)
public function __construct(private ?string $section = null)
{
$this->section = $section;
}
public function getSection(): ?string
@@ -59,18 +27,6 @@ final class SystemConfiguration
return $this->section;
}
/**
* @deprecated since 1.16.10
* @param string|null $section
* @return $this
*/
public function setSection(?string $section): SystemConfiguration
{
$this->section = $section;
return $this;
}
public function setTranslation(string $translation): SystemConfiguration
{
$this->translation = $translation;

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Form\Model;
use App\Entity\User;
final class TotpActivation
{
private ?string $code = null;
public function __construct(private User $user)
{
}
public function getUser(): User
{
return $this->user;
}
public function setCode(?string $code): void
{
$this->code = $code;
}
public function getCode(): ?string
{
return $this->code;
}
}