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

@@ -62,19 +62,25 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
* columns={"birthdate"}
* )
* })
* @ORM\Index(
* name="person_names",
* columns={"firstName", "lastName"}
* ),
* @ORM\Index(
* name="person_birthdate",
* columns={"birthdate"}
* )
* })
*
* @ORM\HasLifecycleCallbacks
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "person": Person::class
* })
*
* @PersonHasCenter
*
* @HouseholdMembershipSequential(
* groups={"household_memberships"}
* )
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['person' => Person::class])]
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface, \Stringable
{
final public const BOTH_GENDER = 'both';
@@ -282,35 +288,27 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The person's deathdate.
*
* @ORM\Column(type="date_immutable", nullable=true)
*
* @Assert\Date
*
* @Assert\GreaterThanOrEqual(propertyPath="birthdate")
*
* @Assert\LessThanOrEqual("today")
*/
#[Assert\Date]
#[Assert\GreaterThanOrEqual(propertyPath: 'birthdate')]
#[Assert\LessThanOrEqual('today')]
private ?\DateTimeImmutable $deathdate = null;
/**
* The person's email.
*
* @ORM\Column(type="text", nullable=true)
*
* @Assert\Email()
*/
#[Assert\Email]
private ?string $email = '';
/**
* The person's first name.
*
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank(message="The firstname cannot be empty")
*
* @Assert\Length(
* max=255,
* )
*/
#[Assert\NotBlank(message: 'The firstname cannot be empty')]
#[Assert\Length(max: 255)]
private string $firstName = '';
/**
@@ -325,9 +323,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The person's gender.
*
* @ORM\Column(type="string", length=9, nullable=true)
*
* @Assert\NotNull(message="The gender must be set")
*/
#[Assert\NotNull(message: 'The gender must be set')]
private ?string $gender = null;
/**
@@ -374,13 +371,9 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The person's last name.
*
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank(message="The lastname cannot be empty")
*
* @Assert\Length(
* max=255,
* )
*/
#[Assert\NotBlank(message: 'The lastname cannot be empty')]
#[Assert\Length(max: 255)]
private string $lastName = '';
/**
@@ -403,9 +396,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* The date of the last marital status change of the person.
*
* @ORM\Column(type="date", nullable=true)
*
* @Assert\Date
*/
#[Assert\Date]
private ?\DateTime $maritalStatusDate = null;
/**
@@ -451,11 +443,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* cascade={"persist", "remove", "merge", "detach"},
* orphanRemoval=true
* )
*
* @Assert\Valid(
* traverse=true,
* )
*/
#[Assert\Valid(traverse: true)]
private Collection $otherPhoneNumbers;
/**
@@ -1410,11 +1399,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* Validation callback that checks if the accompanying periods are valid.
*
* This method add violation errors.
*
* @Assert\Callback(
* groups={"accompanying_period_consistent"}
* )
*/
#[Assert\Callback(groups: ['accompanying_period_consistent'])]
public function isAccompanyingPeriodValid(ExecutionContextInterface $context)
{
$r = $this->checkAccompanyingPeriodsAreNotCollapsing();
@@ -1439,11 +1425,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* two addresses with the same validFrom date).
*
* This method add violation errors.
*
* @Assert\Callback(
* groups={"addresses_consistent"}
* )
*/
#[Assert\Callback(groups: ['addresses_consistent'])]
public function isAddressesValid(ExecutionContextInterface $context)
{
if ($this->hasTwoAdressWithSameValidFromDate()) {