Cherry-pick phpstan fixes after rector changes

This commit is contained in:
2024-08-27 15:57:10 +02:00
parent 94d6b5eff8
commit 85e2466611
7 changed files with 69 additions and 64 deletions

View File

@@ -21,6 +21,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\ReadableCollection;
use Doctrine\Common\Collections\Selectable;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
@@ -35,7 +36,7 @@ class Household implements HasCentersInterface
/**
* Addresses.
*
* @var Collection<Address>
* @var Collection<int, \Chill\MainBundle\Entity\Address>
*/
#[Serializer\Groups(['write'])]
#[ORM\ManyToMany(targetEntity: Address::class, cascade: ['persist', 'remove', 'merge', 'detach'])]
@@ -47,33 +48,33 @@ class Household implements HasCentersInterface
private CommentEmbeddable $commentMembers;
/**
* @var Collection&Selectable<int, HouseholdComposition>
* @var ArrayCollection<int, HouseholdComposition>
*/
#[Assert\Valid(traverse: true, groups: ['household_composition'])]
#[ORM\OneToMany(targetEntity: HouseholdComposition::class, mappedBy: 'household', orphanRemoval: true, cascade: ['persist'])]
#[Assert\Valid(groups: ['household_composition'], traverse: true)]
#[ORM\OneToMany(mappedBy: 'household', targetEntity: HouseholdComposition::class, cascade: ['persist'], orphanRemoval: true)]
#[ORM\OrderBy(['startDate' => Criteria::DESC])]
private Collection&Selectable $compositions;
private ArrayCollection $compositions;
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\Column(type: Types::INTEGER)]
private ?int $id = null;
/**
* @var Collection<HouseholdMember>
* @var Collection<int, HouseholdMember>
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: HouseholdMember::class, mappedBy: 'household')]
#[ORM\OneToMany(mappedBy: 'household', targetEntity: HouseholdMember::class)]
private Collection $members;
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'waiting_for_birth', options: ['default' => false])]
#[ORM\Column(name: 'waiting_for_birth', type: Types::BOOLEAN, options: ['default' => false])]
#[Assert\Type('boolean', groups: ['household_metadata'])]
private bool $waitingForBirth = false;
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, name: 'waiting_for_birth_date', nullable: true, options: ['default' => null])]
#[ORM\Column(type: Types::DATE_IMMUTABLE, name: 'waiting_for_birth_date', nullable: true, options: ['default' => null])]
#[Assert\Expression('this.getWaitingForBirth() == false or value != null', message: 'The waiting for birth date must be set', groups: ['household_metadata'])]
private ?\DateTimeImmutable $waitingForBirthDate = null;