mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
DX: fix phpstan issues
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -82,7 +82,7 @@ class HouseholdController extends AbstractController
|
||||
}
|
||||
|
||||
usort($accompanyingPeriods, static function ($a, $b) {
|
||||
return $b->getOpeningDate() > $a->getOpeningDate();
|
||||
return $b->getOpeningDate() <=> $a->getOpeningDate();
|
||||
});
|
||||
|
||||
$oldMembers = $household->getNonCurrentMembers();
|
||||
|
@@ -42,6 +42,7 @@ use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\Common\Collections\ReadableCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Iterator;
|
||||
use LogicException;
|
||||
@@ -615,9 +616,9 @@ class AccompanyingPeriod implements
|
||||
/**
|
||||
* Get a list of person which have an adresse available for a valid location.
|
||||
*
|
||||
* @return Collection|Person[]
|
||||
* @return ReadableCollection<(int|string), Person>
|
||||
*/
|
||||
public function getAvailablePersonLocation(): Collection
|
||||
public function getAvailablePersonLocation(): ReadableCollection
|
||||
{
|
||||
return $this->getOpenParticipations()
|
||||
->filter(
|
||||
@@ -675,8 +676,9 @@ class AccompanyingPeriod implements
|
||||
|
||||
/**
|
||||
* @Groups({"read"})
|
||||
* @return ReadableCollection<(int|string), Comment>
|
||||
*/
|
||||
public function getComments(): Collection
|
||||
public function getComments(): ReadableCollection
|
||||
{
|
||||
$pinnedComment = $this->pinnedComment;
|
||||
|
||||
@@ -700,7 +702,7 @@ class AccompanyingPeriod implements
|
||||
/**
|
||||
* @Groups({"docgen:read"})
|
||||
*/
|
||||
public function getCurrentParticipations(): Collection
|
||||
public function getCurrentParticipations(): ReadableCollection
|
||||
{
|
||||
return $this->getOpenParticipations();
|
||||
}
|
||||
@@ -834,7 +836,10 @@ class AccompanyingPeriod implements
|
||||
return $collection->count() > 0 ? $collection->first() : null;
|
||||
}
|
||||
|
||||
public function getOpenParticipations(): Collection
|
||||
/**
|
||||
* @return ReadableCollection<(int|string), AccompanyingPeriodParticipation>
|
||||
*/
|
||||
public function getOpenParticipations(): ReadableCollection
|
||||
{
|
||||
return $this
|
||||
->getParticipations()
|
||||
@@ -860,8 +865,9 @@ class AccompanyingPeriod implements
|
||||
|
||||
/**
|
||||
* Get the participation containing a person.
|
||||
* @return ReadableCollection<(int|string), AccompanyingPeriodParticipation>
|
||||
*/
|
||||
public function getParticipationsContainsPerson(Person $person): Collection
|
||||
public function getParticipationsContainsPerson(Person $person): ReadableCollection
|
||||
{
|
||||
return $this
|
||||
->getParticipations()
|
||||
|
@@ -22,6 +22,7 @@ use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\Common\Collections\ReadableCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
@@ -265,7 +266,7 @@ class Household
|
||||
* @Serializer\Groups({"read"})
|
||||
* @Serializer\SerializedName("current_members_id")
|
||||
*/
|
||||
public function getCurrentMembersIds(?DateTimeImmutable $now = null): Collection
|
||||
public function getCurrentMembersIds(?DateTimeImmutable $now = null): ReadableCollection
|
||||
{
|
||||
return $this->getCurrentMembers($now)->map(
|
||||
static fn (HouseholdMember $m) => $m->getId()
|
||||
@@ -332,9 +333,9 @@ class Household
|
||||
*
|
||||
* Return a list of Person, instead of a list of HouseholdMembers
|
||||
*
|
||||
* @return Person[]
|
||||
* @return ReadableCollection<(int|string), Person>
|
||||
*/
|
||||
public function getCurrentPersons(?DateTimeImmutable $now = null): Collection
|
||||
public function getCurrentPersons(?DateTimeImmutable $now = null): ReadableCollection
|
||||
{
|
||||
return $this->getCurrentMembers($now)
|
||||
->map(static function (HouseholdMember $m) {
|
||||
@@ -358,9 +359,9 @@ class Household
|
||||
/**
|
||||
* get all the members during a given membership.
|
||||
*
|
||||
* @return Collection|HouseholdMember[]
|
||||
* @return ReadableCollection<(int|string), HouseholdMember>
|
||||
*/
|
||||
public function getMembersDuringMembership(HouseholdMember $membership): Collection
|
||||
public function getMembersDuringMembership(HouseholdMember $membership): ReadableCollection
|
||||
{
|
||||
return $this->getMembersOnRange(
|
||||
$membership->getStartDate(),
|
||||
@@ -384,7 +385,7 @@ class Household
|
||||
return $this->getMembers()->matching($criteria);
|
||||
}
|
||||
|
||||
public function getMembersOnRange(DateTimeImmutable $from, ?DateTimeImmutable $to): Collection
|
||||
public function getMembersOnRange(DateTimeImmutable $from, ?DateTimeImmutable $to): ReadableCollection
|
||||
{
|
||||
return $this->getMembers()->filter(static function (HouseholdMember $m) use ($from, $to) {
|
||||
if (null === $m->getEndDate() && null !== $to) {
|
||||
|
@@ -28,11 +28,15 @@ class PickPersonDynamicType extends AbstractType
|
||||
{
|
||||
private DenormalizerInterface $denormalizer;
|
||||
|
||||
private DenormalizerInterface $normalizer;
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
private SerializerInterface $serializer;
|
||||
|
||||
public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, NormalizerInterface $normalizer)
|
||||
public function __construct(
|
||||
DenormalizerInterface $denormalizer,
|
||||
SerializerInterface $serializer,
|
||||
NormalizerInterface $normalizer
|
||||
)
|
||||
{
|
||||
$this->denormalizer = $denormalizer;
|
||||
$this->serializer = $serializer;
|
||||
|
@@ -27,6 +27,7 @@ use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
@@ -159,9 +160,9 @@ class AccompanyingPeriodContext implements
|
||||
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, mixed $entity): void
|
||||
{
|
||||
$options = $template->getOptions();
|
||||
$persons = $entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
|
||||
$persons = new ArrayCollection($entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
|
||||
return $p->getPerson();
|
||||
});
|
||||
})->toArray());
|
||||
|
||||
foreach ($entity->getCurrentParticipations() as $p) {
|
||||
foreach ($p->getPerson()->getResources() as $r) {
|
||||
|
@@ -102,7 +102,9 @@ class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInte
|
||||
->getAccompanyingPeriod()
|
||||
->getUser();
|
||||
|
||||
$suggestedUsers[spl_object_hash($referrer)] = $referrer;
|
||||
if (null !== $referrer) {
|
||||
$suggestedUsers[spl_object_hash($referrer)] = $referrer;
|
||||
}
|
||||
|
||||
return $suggestedUsers;
|
||||
}
|
||||
|
Reference in New Issue
Block a user