Apply rector rules: symfony up to 54

This commit is contained in:
2024-04-04 23:30:25 +02:00
parent 1ee3b9e2f0
commit 579bd829f8
204 changed files with 974 additions and 2346 deletions

View File

@@ -47,11 +47,9 @@ class SingleTask extends AbstractTask
{
/**
* @ORM\Column(name="end_date", type="date", nullable=true)
*
* @Assert\Date
*
* @Serializer\Groups({"read"})
*/
#[Assert\Date]
#[Serializer\Groups(['read'])]
private ?\DateTime $endDate = null;
/**
@@ -60,9 +58,8 @@ class SingleTask extends AbstractTask
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?int $id = null;
/**
@@ -75,20 +72,11 @@ class SingleTask extends AbstractTask
/**
* @ORM\Column(name="start_date", type="date", nullable=true)
*
* @Serializer\Groups({"read"})
*
* @Assert\Date
*
* @Assert\Expression(
* "value === null or this.getEndDate() === null or value < this.getEndDate()",
* message="The start date must be before the end date"
* )
* @Assert\Expression(
* "value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()",
* message="The start date must be before warning date"
* )
*/
#[Serializer\Groups(['read'])]
#[Assert\Date]
#[Assert\Expression('value === null or this.getEndDate() === null or value < this.getEndDate()', message: 'The start date must be before the end date')]
#[Assert\Expression('value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()', message: 'The start date must be before warning date')]
private ?\DateTime $startDate = null;
/**
@@ -104,14 +92,9 @@ class SingleTask extends AbstractTask
/**
* @ORM\Column(name="warning_interval", type="dateinterval", nullable=true)
*
* @Serializer\Groups({"read"})
*
* @Assert\Expression(
* "!(value != null and this.getEndDate() == null)",
* message="An end date is required if a warning interval is set"
* )
*/
#[Serializer\Groups(['read'])]
#[Assert\Expression('!(value != null and this.getEndDate() == null)', message: 'An end date is required if a warning interval is set')]
private ?\DateInterval $warningInterval = null;
public function __construct()
@@ -164,9 +147,8 @@ class SingleTask extends AbstractTask
* Return null if warningDate or endDate is null
*
* @return \DateTimeImmutable
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public function getWarningDate()
{
if (null === $this->getWarningInterval()) {