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

@@ -135,14 +135,14 @@ class AccompanyingPeriod implements
private ?Location $administrativeLocation = null;
/**
* @var Collection&Selectable<int, Calendar>
* @var ArrayCollection<int, Calendar>
*/
#[ORM\OneToMany(targetEntity: Calendar::class, mappedBy: 'accompanyingPeriod')]
private Collection&Selectable $calendars;
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: Calendar::class)]
private ArrayCollection $calendars;
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
#[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', groups: [AccompanyingPeriod::STEP_CLOSED], message: 'The closing date must be later than the date of creation')]
#[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', message: 'The closing date must be later than the date of creation', groups: [AccompanyingPeriod::STEP_CLOSED])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $closingDate = null;
@@ -153,10 +153,10 @@ class AccompanyingPeriod implements
private ?ClosingMotive $closingMotive = null;
/**
* @var Collection<Comment>
* @var Collection<(int|string), Comment>
*/
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])]
#[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: Comment::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['createdAt' => Criteria::DESC, 'id' => 'DESC'])]
private Collection $comments;
@@ -194,9 +194,9 @@ class AccompanyingPeriod implements
private ?UserJob $job = null;
/**
* @var Collection<AccompanyingPeriodLocationHistory>
* @var Collection<int, AccompanyingPeriodLocationHistory>
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriodLocationHistory::class, mappedBy: 'period', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'period', targetEntity: AccompanyingPeriodLocationHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $locationHistories;
#[Groups(['read', 'write', 'docgen:read'])]
@@ -212,10 +212,10 @@ class AccompanyingPeriod implements
private ?Origin $origin = null;
/**
* @var Collection<AccompanyingPeriodParticipation>
* @var Collection<int, AccompanyingPeriodParticipation>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodParticipation::class, mappedBy: 'accompanyingPeriod', orphanRemoval: true, cascade: ['persist', 'refresh', 'remove', 'merge', 'detach'])]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: AccompanyingPeriodParticipation::class, cascade: ['persist', 'refresh', 'remove', 'merge', 'detach'], orphanRemoval: true)]
#[ParticipationOverlap(groups: [AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED])]
private Collection $participations;
@@ -246,7 +246,7 @@ class AccompanyingPeriod implements
private ?ThirdParty $requestorThirdParty = null;
/**
* @var Collection<resource>
* @var Collection<int, Resource>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriod\Resource::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
@@ -254,7 +254,7 @@ class AccompanyingPeriod implements
private Collection $resources;
/**
* @var Collection<Scope>
* @var Collection<int, Scope>
*/
#[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')]
@@ -263,7 +263,7 @@ class AccompanyingPeriod implements
private Collection $scopes;
/**
* @var Collection<SocialIssue>
* @var Collection<int, SocialIssue>
*/
#[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')]
@@ -279,9 +279,9 @@ class AccompanyingPeriod implements
private ?string $step = self::STEP_DRAFT;
/**
* @var Collection<AccompanyingPeriodStepHistory>
* @var Collection<int, AccompanyingPeriodStepHistory>
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriodStepHistory::class, mappedBy: 'period', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'period', targetEntity: AccompanyingPeriodStepHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $stepHistories;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
@@ -296,7 +296,7 @@ class AccompanyingPeriod implements
private ?User $user = null;
/**
* @var Collection<UserHistory>
* @var Collection<int, UserHistory>
*/
#[ORM\OneToMany(targetEntity: UserHistory::class, mappedBy: 'accompanyingPeriod', orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $userHistories;
@@ -311,10 +311,10 @@ class AccompanyingPeriod implements
private ?User $userPrevious = null;
/**
* @var Collection<AccompanyingPeriodWork>
* @var Collection<int, AccompanyingPeriodWork>
*/
#[Assert\Valid(traverse: true)]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWork::class, mappedBy: 'accompanyingPeriod')]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: AccompanyingPeriodWork::class)]
private Collection $works;
/**
@@ -801,7 +801,7 @@ class AccompanyingPeriod implements
/**
* Get a list of all persons which are participating to this course.
*
* @psalm-return Collection<(int|string), Person|null>
* @psalm-return Collection<int, Person|null>
*/
public function getPersons(): Collection
{