DX: fix cs

This commit is contained in:
2023-04-15 00:43:55 +02:00
parent 80647147ee
commit 746ed4f5e5
188 changed files with 309 additions and 308 deletions

View File

@@ -169,7 +169,7 @@ final class AccompanyingCourseApiController extends ApiController
$accompanyingPeriods = $person->getCurrentAccompanyingPeriods();
$accompanyingPeriodsChecked = array_filter(
$accompanyingPeriods,
fn(AccompanyingPeriod $period) => $this->isGranted(AccompanyingPeriodVoter::SEE, $period)
fn (AccompanyingPeriod $period) => $this->isGranted(AccompanyingPeriodVoter::SEE, $period)
);
return $this->json(array_values($accompanyingPeriodsChecked), Response::HTTP_OK, [], ['groups' => ['read']]);

View File

@@ -222,10 +222,10 @@ class AccompanyingPeriodController extends AbstractController
$accompanyingPeriodsRaw = $this->accompanyingPeriodACLAwareRepository
->findByPerson($person, AccompanyingPeriodVoter::SEE);
usort($accompanyingPeriodsRaw, static fn($a, $b) => $b->getOpeningDate() > $a->getOpeningDate());
usort($accompanyingPeriodsRaw, static fn ($a, $b) => $b->getOpeningDate() > $a->getOpeningDate());
// filter visible or not visible
$accompanyingPeriods = array_filter($accompanyingPeriodsRaw, fn(AccompanyingPeriod $ap) => $this->isGranted(AccompanyingPeriodVoter::SEE, $ap));
$accompanyingPeriods = array_filter($accompanyingPeriodsRaw, fn (AccompanyingPeriod $ap) => $this->isGranted(AccompanyingPeriodVoter::SEE, $ap));
return $this->render('@ChillPerson/AccompanyingPeriod/list.html.twig', [
'accompanying_periods' => $accompanyingPeriods,
@@ -327,7 +327,7 @@ class AccompanyingPeriodController extends AbstractController
/** @var AccompanyingPeriod $period */
$period = array_filter(
$person->getAccompanyingPeriods(),
static fn(AccompanyingPeriod $p) => $p->getId() === ($period_id)
static fn (AccompanyingPeriod $p) => $p->getId() === ($period_id)
)[0] ?? null;
if (null === $period) {

View File

@@ -105,8 +105,8 @@ class AccompanyingPeriodRegulationListController
$builder
->add('services', EntityType::class, [
'class' => Scope::class,
'query_builder' => static fn(EntityRepository $er) => $er->createQueryBuilder('s'),
'choice_label' => fn(Scope $s) => $this->translatableStringHelper->localize($s->getName()),
'query_builder' => static fn (EntityRepository $er) => $er->createQueryBuilder('s'),
'choice_label' => fn (Scope $s) => $this->translatableStringHelper->localize($s->getName()),
'multiple' => true,
'label' => 'Service',
'required' => false,
@@ -119,7 +119,7 @@ class AccompanyingPeriodRegulationListController
return $qb;
},
'choice_label' => fn(UserJob $j) => $this->translatableStringHelper->localize($j->getLabel()),
'choice_label' => fn (UserJob $j) => $this->translatableStringHelper->localize($j->getLabel()),
'multiple' => true,
'label' => 'Métier',
'required' => false,
@@ -141,7 +141,7 @@ class AccompanyingPeriodRegulationListController
return $qb;
},
'choice_label' => static fn(Location $l) => $l->getName(),
'choice_label' => static fn (Location $l) => $l->getName(),
'multiple' => true,
'group_by' => function (Location $l) {
if (null === $type = $l->getLocationType()) {

View File

@@ -164,7 +164,7 @@ class HouseholdCompositionController extends AbstractController
$isEdit = $request->query->has('edit');
if ($isEdit) {
$householdCompositions = $household->getCompositions()->filter(static fn(HouseholdComposition $composition) => $composition->getId() === $request->query->getInt('edit'));
$householdCompositions = $household->getCompositions()->filter(static fn (HouseholdComposition $composition) => $composition->getId() === $request->query->getInt('edit'));
if ($householdCompositions->count() !== 1) {
throw new BadRequestHttpException('could not find the composition with this id associated to the household');

View File

@@ -81,7 +81,7 @@ class HouseholdController extends AbstractController
}
}
usort($accompanyingPeriods, static fn($a, $b) => $b->getOpeningDate() <=> $a->getOpeningDate());
usort($accompanyingPeriods, static fn ($a, $b) => $b->getOpeningDate() <=> $a->getOpeningDate());
$oldMembers = $household->getNonCurrentMembers();
$accompanyingPeriodsOld = [];

View File

@@ -108,10 +108,10 @@ class PersonApiController extends ApiController
$addresses = $person
->getAccompanyingPeriodParticipations()
->filter(
static fn(AccompanyingPeriodParticipation $accompanyingPeriodParticipation): bool => null !== $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation()
static fn (AccompanyingPeriodParticipation $accompanyingPeriodParticipation): bool => null !== $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation()
)
->map(
static fn(AccompanyingPeriodParticipation $accompanyingPeriodParticipation): ?Address => $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation()
static fn (AccompanyingPeriodParticipation $accompanyingPeriodParticipation): ?Address => $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation()
)
->filter(
// We remove potential null addresses.

View File

@@ -44,7 +44,7 @@ class SocialWorkSocialActionApiController extends ApiController
$socialActions = $socialIssue->getRecursiveSocialActions()->toArray();
usort($socialActions, static fn(SocialAction $sa, SocialAction $sb) => $sa->getOrdering() <=> $sb->getOrdering());
usort($socialActions, static fn (SocialAction $sa, SocialAction $sb) => $sa->getOrdering() <=> $sb->getOrdering());
$pagination = $this->paginator->create(count($socialActions));
// max one page

View File

@@ -115,7 +115,7 @@ class LoadCustomFields extends AbstractFixture implements
// get possible values for cfGroup
$choices = array_map(
static fn($a) => $a['slug'],
static fn ($a) => $a['slug'],
$this->customFieldChoice->getOptions()['choices']
);
// create faker

View File

@@ -828,7 +828,7 @@ class AccompanyingPeriod implements
$collection = $this
->getParticipationsContainsPerson($person)
->filter(
static fn(AccompanyingPeriodParticipation $participation): bool => null === $participation->getEndDate()
static fn (AccompanyingPeriodParticipation $participation): bool => null === $participation->getEndDate()
);
return $collection->count() > 0 ? $collection->first() : null;
@@ -842,7 +842,7 @@ class AccompanyingPeriod implements
return $this
->getParticipations()
->filter(
static fn(AccompanyingPeriodParticipation $participation): bool => null === $participation->getEndDate()
static fn (AccompanyingPeriodParticipation $participation): bool => null === $participation->getEndDate()
);
}

View File

@@ -202,7 +202,7 @@ class Household
{
$at ??= new DateTime('today');
$addrs = $this->getAddresses()->filter(static fn(Address $a) => $a->getValidFrom() <= $at && (
$addrs = $this->getAddresses()->filter(static fn (Address $a) => $a->getValidFrom() <= $at && (
null === $a->getValidTo() || $a->getValidTo() > $at
));
@@ -336,7 +336,7 @@ class Household
public function getCurrentPersons(?DateTimeImmutable $now = null): ReadableCollection
{
return $this->getCurrentMembers($now)
->map(static fn(HouseholdMember $m) => $m->getPerson());
->map(static fn (HouseholdMember $m) => $m->getPerson());
}
public function getId(): ?int
@@ -363,7 +363,7 @@ class Household
$membership->getStartDate(),
$membership->getEndDate()
)->filter(
static fn(HouseholdMember $m) => $m->getPerson() !== $membership->getPerson()
static fn (HouseholdMember $m) => $m->getPerson() !== $membership->getPerson()
);
}
@@ -502,7 +502,7 @@ class Household
usort(
$compositionOrdered,
static fn(HouseholdComposition $a, HouseholdComposition $b) => $a->getStartDate() <=> $b->getStartDate()
static fn (HouseholdComposition $a, HouseholdComposition $b) => $a->getStartDate() <=> $b->getStartDate()
);
$iterator = new ArrayIterator($compositionOrdered);

View File

@@ -775,7 +775,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
): int {
// TODO should be optimized to avoid loading accompanying period ?
return $this->getAccompanyingPeriodInvolved($asParticipantOpen, $asRequestor)
->filter(fn(AccompanyingPeriod $p) => $p->getStep() !== AccompanyingPeriod::STEP_DRAFT)
->filter(fn (AccompanyingPeriod $p) => $p->getStep() !== AccompanyingPeriod::STEP_DRAFT)
->count();
}
@@ -1339,7 +1339,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $this->getAccompanyingPeriodParticipations()
->matching($criteria)
->filter(static fn(AccompanyingPeriodParticipation $app) => AccompanyingPeriod::STEP_CLOSED !== $app->getAccompanyingPeriod()->getStep());
->filter(static fn (AccompanyingPeriodParticipation $app) => AccompanyingPeriod::STEP_CLOSED !== $app->getAccompanyingPeriod()->getStep());
}
public function getOtherPhoneNumbers(): Collection

View File

@@ -128,7 +128,7 @@ final class GeographicalUnitStatAggregator implements AggregatorInterface
'placeholder' => 'Select a geographical layer',
'class' => GeographicalUnitLayer::class,
'choices' => $this->geographicalUnitLayerRepository->findAllHavingUnits(),
'choice_label' => fn(GeographicalUnitLayer $item) => $this->translatableStringHelper->localize($item->getName()),
'choice_label' => fn (GeographicalUnitLayer $item) => $this->translatableStringHelper->localize($item->getName()),
]);
}

View File

@@ -147,7 +147,7 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme
];
}
return static fn(string $value): string => $labels[$value];
return static fn (string $value): string => $labels[$value];
}
public function getQueryKeys($data)

View File

@@ -100,7 +100,7 @@ class GeographicalUnitAggregator implements AggregatorInterface
'placeholder' => 'Select a geographical layer',
'class' => GeographicalUnitLayer::class,
'choices' => $this->geographicalUnitLayerRepository->findAllHavingUnits(),
'choice_label' => fn(GeographicalUnitLayer $item) => $this->translatableStringHelper->localize($item->getName()),
'choice_label' => fn (GeographicalUnitLayer $item) => $this->translatableStringHelper->localize($item->getName()),
]);
}

View File

@@ -141,7 +141,7 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV
];
}
return static fn($value): string => $labels[$value];
return static fn ($value): string => $labels[$value];
}
public function getQueryKeys($data)

View File

@@ -64,7 +64,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return static fn($value) => $labels[$value];
return static fn ($value) => $labels[$value];
}
public function getQueryKeys($data): array
@@ -89,7 +89,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->repository->createQueryBuilder('acp');

View File

@@ -63,7 +63,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return static fn($value) => $labels[$value];
return static fn ($value) => $labels[$value];
}
public function getQueryKeys($data): array
@@ -88,7 +88,7 @@ class CountAccompanyingPeriodWork implements ExportInterface, GroupedExportInter
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->em->createQueryBuilder();

View File

@@ -62,7 +62,7 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return static fn($value) => $labels[$value];
return static fn ($value) => $labels[$value];
}
public function getQueryKeys($data): array
@@ -87,7 +87,7 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->entityManager->createQueryBuilder();

View File

@@ -113,7 +113,7 @@ class CountHousehold implements ExportInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->entityManager->createQueryBuilder();

View File

@@ -62,7 +62,7 @@ class CountPerson implements ExportInterface, GroupedExportInterface
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return static fn($value) => $labels[$value];
return static fn ($value) => $labels[$value];
}
public function getQueryKeys($data)
@@ -92,7 +92,7 @@ class CountPerson implements ExportInterface, GroupedExportInterface
*/
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->personRepository->createQueryBuilder('person');

View File

@@ -64,7 +64,7 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return static fn($value) => $labels[$value];
return static fn ($value) => $labels[$value];
}
public function getQueryKeys($data): array
@@ -89,7 +89,7 @@ class CountPersonWithAccompanyingCourse implements ExportInterface, GroupedExpor
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->repository->createQueryBuilder('acp');

View File

@@ -290,7 +290,7 @@ class ListAccompanyingPeriod implements ListInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->entityManager->createQueryBuilder();

View File

@@ -263,7 +263,7 @@ class ListAccompanyingPeriodWork implements ListInterface, GroupedExportInterfac
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->entityManager->createQueryBuilder();

View File

@@ -241,7 +241,7 @@ class ListEvaluation implements ListInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->entityManager->createQueryBuilder();

View File

@@ -146,7 +146,7 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->entityManager->createQueryBuilder();

View File

@@ -191,7 +191,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
*/
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
// throw an error if any fields are present
if (!array_key_exists('fields', $data)) {

View File

@@ -159,7 +159,7 @@ class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterfac
*/
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
// throw an error if any fields are present
if (!array_key_exists('fields', $data)) {

View File

@@ -112,7 +112,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
{
$centers = array_map(static fn($el) => $el['center'], $acl);
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->repository->createQueryBuilder('acp');

View File

@@ -59,7 +59,7 @@ class ClosingMotiveFilter implements FilterInterface
{
$builder->add('accepted_closingmotives', EntityType::class, [
'class' => ClosingMotive::class,
'choice_label' => fn(ClosingMotive $cm) => $this->translatableStringHelper->localize($cm->getName()),
'choice_label' => fn (ClosingMotive $cm) => $this->translatableStringHelper->localize($cm->getName()),
'multiple' => true,
'expanded' => true,
]);

View File

@@ -61,7 +61,7 @@ class CreatorJobFilter implements FilterInterface
$builder->add('creator_job', EntityType::class, [
'class' => UserJob::class,
'choices' => $this->userJobRepository->findAllActive(),
'choice_label' => fn(UserJob $j) => $this->translatableStringHelper->localize(
'choice_label' => fn (UserJob $j) => $this->translatableStringHelper->localize(
$j->getLabel()
),
'multiple' => true,

View File

@@ -69,7 +69,7 @@ class EvaluationFilter implements FilterInterface
$builder->add('accepted_evaluations', EntityType::class, [
'class' => Evaluation::class,
'choices' => $this->evaluationRepository->findAllActive(),
'choice_label' => fn(Evaluation $ev) => $this->translatableStringHelper->localize($ev->getTitle()),
'choice_label' => fn (Evaluation $ev) => $this->translatableStringHelper->localize($ev->getTitle()),
'multiple' => true,
'expanded' => false,
'attr' => ['class' => 'select2'],

View File

@@ -107,7 +107,7 @@ class GeographicalUnitStatFilter implements FilterInterface
'placeholder' => 'Select a geographical unit',
'choices' => $this->geographicalUnitRepository->findAll(),
'choice_value' => static fn (SimpleGeographicalUnitDTO $item) => $item->id,
'choice_label' => fn(SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()) . ' > ' . $item->unitName,
'choice_label' => fn (SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()) . ' > ' . $item->unitName,
'attr' => [
'class' => 'select2',
],
@@ -122,7 +122,7 @@ class GeographicalUnitStatFilter implements FilterInterface
'%units' => implode(
', ',
array_map(
fn(SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()) . ' > ' . $item->unitName,
fn (SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()) . ' > ' . $item->unitName,
$data['units']
)
),

View File

@@ -59,7 +59,7 @@ class OriginFilter implements FilterInterface
{
$builder->add('accepted_origins', EntityType::class, [
'class' => Origin::class,
'choice_label' => fn(Origin $o) => $this->translatableStringHelper->localize($o->getLabel()),
'choice_label' => fn (Origin $o) => $this->translatableStringHelper->localize($o->getLabel()),
'multiple' => true,
'expanded' => true,
]);

View File

@@ -59,7 +59,7 @@ final class EvaluationTypeFilter implements FilterInterface
{
$builder->add('accepted_evaluationtype', EntityType::class, [
'class' => Evaluation::class,
'choice_label' => fn(Evaluation $ev): string => $this->translatableStringHelper->localize($ev->getTitle()),
'choice_label' => fn (Evaluation $ev): string => $this->translatableStringHelper->localize($ev->getTitle()),
'multiple' => true,
'expanded' => true,
]);

View File

@@ -78,7 +78,7 @@ class CompositionFilter implements FilterInterface
$builder
->add('accepted_composition', EntityType::class, [
'class' => HouseholdCompositionType::class,
'choice_label' => fn(HouseholdCompositionType $type) => $this->translatableStringHelper->localize(
'choice_label' => fn (HouseholdCompositionType $type) => $this->translatableStringHelper->localize(
$type->getLabel()
),
'multiple' => true,

View File

@@ -81,7 +81,7 @@ class AddressRefStatusFilter implements \Chill\MainBundle\Export\FilterInterface
->add('ref_statuses', ChoiceType::class, [
'label' => 'export.filter.person.by_address_ref_status.Status',
'choices' => [Address::ADDR_REFERENCE_STATUS_TO_REVIEW, Address::ADDR_REFERENCE_STATUS_REVIEWED, Address::ADDR_REFERENCE_STATUS_MATCH],
'choice_label' => fn(string $item) => 'export.filter.person.by_address_ref_status.'.$item,
'choice_label' => fn (string $item) => 'export.filter.person.by_address_ref_status.'.$item,
'multiple' => true,
'expanded' => true,
'data' => [Address::ADDR_REFERENCE_STATUS_TO_REVIEW]
@@ -97,7 +97,7 @@ class AddressRefStatusFilter implements \Chill\MainBundle\Export\FilterInterface
'%statuses%' => implode(
', ',
array_map(
fn(string $item) => 'export.filter.person.by_address_ref_status.'.$item,
fn (string $item) => 'export.filter.person.by_address_ref_status.'.$item,
$data['ref_statuses'] ?? RollingDate::T_TODAY
)
),

View File

@@ -67,7 +67,7 @@ class GenderFilter implements
$qb->add('where', $where);
$qb->setParameter('person_gender', array_filter(
$data['accepted_genders'],
static fn($el) => 'null' !== $el
static fn ($el) => 'null' !== $el
));
}

View File

@@ -98,7 +98,7 @@ class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface
'placeholder' => 'Select a geographical unit',
'choices' => $this->geographicalUnitRepository->findAll(),
'choice_value' => static fn (SimpleGeographicalUnitDTO $item) => $item->id,
'choice_label' => fn(SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()) . ' > ' . $item->unitName,
'choice_label' => fn (SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()) . ' > ' . $item->unitName,
'attr' => [
'class' => 'select2',
],
@@ -115,7 +115,7 @@ class GeographicalUnitFilter implements \Chill\MainBundle\Export\FilterInterface
'%units%' => implode(
', ',
array_map(
fn(SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()) . ' > ' . $item->unitName,
fn (SimpleGeographicalUnitDTO $item) => $this->translatableStringHelper->localize($this->geographicalUnitLayerRepository->find($item->layerId)->getName()) . ' > ' . $item->unitName,
$data['units']
)
),

View File

@@ -49,7 +49,7 @@ class MaritalStatusFilter implements FilterInterface
{
$builder->add('maritalStatus', EntityType::class, [
'class' => MaritalStatus::class,
'choice_label' => fn(MaritalStatus $ms) => $this->translatableStringHelper->localize(
'choice_label' => fn (MaritalStatus $ms) => $this->translatableStringHelper->localize(
$ms->getName()
),
'multiple' => true,

View File

@@ -72,7 +72,7 @@ class NationalityFilter implements
{
$countries = $data['nationalities'];
$names = array_map(fn(Country $c) => $this->translatableStringHelper->localize($c->getName()), [$countries]);
$names = array_map(fn (Country $c) => $this->translatableStringHelper->localize($c->getName()), [$countries]);
return [
'Filtered by nationality : %nationalities%',

View File

@@ -100,7 +100,7 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface
$builder->add('thirdparty_cat', EntityType::class, [
'class' => ThirdPartyCategory::class,
'label' => 'Category',
'choice_label' => fn(ThirdPartyCategory $tpc) => $this->translatableStringHelper->localize($tpc->getName()),
'choice_label' => fn (ThirdPartyCategory $tpc) => $this->translatableStringHelper->localize($tpc->getName()),
'multiple' => true,
'expanded' => true,
]);

View File

@@ -69,7 +69,7 @@ class JobFilter implements FilterInterface
{
$builder->add('job', EntityType::class, [
'class' => UserJob::class,
'choice_label' => fn(UserJob $j) => $this->translatableStringHelper->localize(
'choice_label' => fn (UserJob $j) => $this->translatableStringHelper->localize(
$j->getLabel()
),
'multiple' => true,

View File

@@ -69,7 +69,7 @@ class ScopeFilter implements FilterInterface
{
$builder->add('scope', EntityType::class, [
'class' => Scope::class,
'choice_label' => fn(Scope $s) => $this->translatableStringHelper->localize(
'choice_label' => fn (Scope $s) => $this->translatableStringHelper->localize(
$s->getName()
),
'multiple' => true,

View File

@@ -55,7 +55,7 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
{
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
$this->lazyLoadedPersons,
static fn(Person $p) => call_user_func($value, $p)
static fn (Person $p) => call_user_func($value, $p)
);
}

View File

@@ -40,7 +40,7 @@ class HouseholdCompositionType extends AbstractType
->add('householdCompositionType', EntityType::class, [
'class' => \Chill\PersonBundle\Entity\Household\HouseholdCompositionType::class,
'choices' => $types,
'choice_label' => fn(\Chill\PersonBundle\Entity\Household\HouseholdCompositionType $type) => $this->translatableStringHelper->localize($type->getLabel()),
'choice_label' => fn (\Chill\PersonBundle\Entity\Household\HouseholdCompositionType $type) => $this->translatableStringHelper->localize($type->getLabel()),
'label' => 'household_composition.Household composition',
])
->add('startDate', ChillDateType::class, [

View File

@@ -118,8 +118,8 @@ class PersonType extends AbstractType
]);
$builder->get('placeOfBirth')->addModelTransformer(new CallbackTransformer(
static fn($string) => strtoupper((string) $string),
static fn($string) => strtoupper((string) $string)
static fn ($string) => strtoupper((string) $string),
static fn ($string) => strtoupper((string) $string)
));
}
@@ -163,7 +163,7 @@ class PersonType extends AbstractType
'allow_delete' => true,
'by_reference' => false,
'label' => false,
'delete_empty' => static fn(?PersonPhone $pp = null) => null === $pp || $pp->isEmpty(),
'delete_empty' => static fn (?PersonPhone $pp = null) => null === $pp || $pp->isEmpty(),
'error_bubbling' => false,
'empty_collection_explain' => 'No additional phone numbers',
]);

View File

@@ -46,7 +46,7 @@ class GoalType extends AbstractType
'class' => Result::class,
'required' => false,
'multiple' => true,
'choice_label' => fn(Result $r) => $this->translatableStringHelper->localize($r->getTitle()),
'choice_label' => fn (Result $r) => $this->translatableStringHelper->localize($r->getTitle()),
'attr' => ['class' => 'select2 '],
])
->add('desactivationDate', ChillDateType::class, [

View File

@@ -50,12 +50,12 @@ class SocialActionType extends AbstractType
->add('issue', EntityType::class, [
'class' => SocialIssue::class,
'label' => 'socialAction.socialIssue',
'choice_label' => fn(SocialIssue $issue) => $this->translatableStringHelper->localize($issue->getTitle()),
'choice_label' => fn (SocialIssue $issue) => $this->translatableStringHelper->localize($issue->getTitle()),
])
->add('parent', EntityType::class, [
'class' => SocialAction::class,
'required' => false,
'choice_label' => fn(SocialAction $issue) => $this->translatableStringHelper->localize($issue->getTitle()),
'choice_label' => fn (SocialAction $issue) => $this->translatableStringHelper->localize($issue->getTitle()),
])
->add('ordering', NumberType::class, [
'required' => true,
@@ -66,7 +66,7 @@ class SocialActionType extends AbstractType
'required' => false,
'multiple' => true,
'attr' => ['class' => 'select2'],
'choice_label' => fn(Result $r) => $this->translatableStringHelper->localize($r->getTitle()),
'choice_label' => fn (Result $r) => $this->translatableStringHelper->localize($r->getTitle()),
])
->add('goals', EntityType::class, [
@@ -74,7 +74,7 @@ class SocialActionType extends AbstractType
'required' => false,
'multiple' => true,
'attr' => ['class' => 'select2'],
'choice_label' => fn(Goal $g) => $this->translatableStringHelper->localize($g->getTitle()),
'choice_label' => fn (Goal $g) => $this->translatableStringHelper->localize($g->getTitle()),
])
->add('evaluations', EntityType::class, [
@@ -82,7 +82,7 @@ class SocialActionType extends AbstractType
'required' => false,
'multiple' => true,
'attr' => ['class' => 'select2'],
'choice_label' => fn(Evaluation $e) => $this->translatableStringHelper->localize($e->getTitle()),
'choice_label' => fn (Evaluation $e) => $this->translatableStringHelper->localize($e->getTitle()),
])
->add('defaultNotificationDelay', DateIntervalType::class, [

View File

@@ -60,13 +60,13 @@ class ClosingMotivePickerType extends AbstractType
'class' => ClosingMotive::class,
'empty_data' => null,
'placeholder' => 'Choose a motive',
'choice_label' => fn(ClosingMotive $cm) => $this->entityRenderExtension->renderString($cm),
'choice_label' => fn (ClosingMotive $cm) => $this->entityRenderExtension->renderString($cm),
'only_leaf' => true,
]);
$resolver
->setAllowedTypes('only_leaf', 'bool')
->setNormalizer('choices', fn(Options $options) => $this->repository
->setNormalizer('choices', fn (Options $options) => $this->repository
->getActiveClosingMotive($options['only_leaf']));
}

View File

@@ -113,9 +113,9 @@ class PickPersonType extends AbstractType
// add the default options
$resolver->setDefaults([
'class' => Person::class,
'choice_label' => static fn(Person $p) => $p->getFirstname() . ' ' . $p->getLastname(),
'choice_label' => static fn (Person $p) => $p->getFirstname() . ' ' . $p->getLastname(),
'placeholder' => 'Pick a person',
'choice_attr' => static fn(Person $p) => [
'choice_attr' => static fn (Person $p) => [
'data-center' => $p->getCenter()->getId(),
],
'attr' => ['class' => 'select2 '],
@@ -135,7 +135,7 @@ class PickPersonType extends AbstractType
protected function filterCentersfom(Options $options)
{
if (null === $options['role']) {
$centers = array_map(static fn(GroupCenter $g) => $g->getCenter(), $this->user->getGroupCenters()->toArray());
$centers = array_map(static fn (GroupCenter $g) => $g->getCenter(), $this->user->getGroupCenters()->toArray());
} else {
$centers = $this->authorizationHelper
->getReachableCenters($this->user, $options['role']->getRole());
@@ -158,7 +158,7 @@ class PickPersonType extends AbstractType
if (
!in_array($c->getId(), array_map(
static fn(Center $c) => $c->getId(),
static fn (Center $c) => $c->getId(),
$centers
), true)
) {

View File

@@ -38,7 +38,7 @@ class PickSocialActionType extends AbstractType
->setDefaults([
'class' => SocialAction::class,
'choices' => $this->actionRepository->findAllActive(),
'choice_label' => fn(SocialAction $sa) => $this->actionRender->renderString($sa, []),
'choice_label' => fn (SocialAction $sa) => $this->actionRender->renderString($sa, []),
'placeholder' => 'Pick a social action',
'required' => false,
'attr' => ['class' => 'select2'],

View File

@@ -38,7 +38,7 @@ class PickSocialIssueType extends AbstractType
->setDefaults([
'class' => SocialIssue::class,
'choices' => $this->issueRepository->findAllActive(),
'choice_label' => fn(SocialIssue $si) => $this->issueRender->renderString($si, []),
'choice_label' => fn (SocialIssue $si) => $this->issueRender->renderString($si, []),
'placeholder' => 'Pick a social issue',
'required' => false,
'attr' => ['class' => 'select2'],

View File

@@ -76,7 +76,7 @@ class PrivacyEventSubscriber implements EventSubscriberInterface
$involved = $this->getInvolved();
$involved['period_id'] = $event->getPeriod()->getId();
$involved['persons'] = $event->getPeriod()->getPersons()
->map(static fn(Person $p) => $p->getId())
->map(static fn (Person $p) => $p->getId())
->toArray();
$this->logger->notice(
@@ -100,7 +100,7 @@ class PrivacyEventSubscriber implements EventSubscriberInterface
if ($event->hasPersons()) {
$involved['persons'] = array_map(
static fn(Person $p) => $p->getId(),
static fn (Person $p) => $p->getId(),
$event->getPersons()
);
}

View File

@@ -322,7 +322,7 @@ final class PersonACLAwareRepository implements PersonACLAwareRepositoryInterfac
),
]
),
array_map(static fn(Center $c) => $c->getId(), $authorizedCenters)
array_map(static fn (Center $c) => $c->getId(), $authorizedCenters)
);
}
}

View File

@@ -97,7 +97,7 @@ class HouseholdVoter extends Voter implements ProvideRoleHierarchyInterface, Chi
private function checkAssociatedMembersRole(Household $household, string $attribute): bool
{
foreach ($household->getCurrentMembers()->map(static fn(HouseholdMember $member) => $member->getPerson()) as $person) {
foreach ($household->getCurrentMembers()->map(static fn (HouseholdMember $member) => $member->getPerson()) as $person) {
if ($this->security->isGranted($attribute, $person)) {
return true;
}

View File

@@ -150,8 +150,8 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
$this->closingMotiveRender->renderString($period->getClosingMotive(), []) : '',
'ref' => $this->normalizer->normalize($period->getUser(), $format, $userContext),
'hasRef' => $period->getUser() !== null,
'socialIssuesText' => implode(', ', array_map(fn(SocialIssue $s) => $this->socialIssueRender->renderString($s, []), $period->getSocialIssues()->toArray())),
'scopesText' => implode(', ', array_map(fn(Scope $s) => $this->translatableStringHelper->localize($s->getName()), $scopes)),
'socialIssuesText' => implode(', ', array_map(fn (SocialIssue $s) => $this->socialIssueRender->renderString($s, []), $period->getSocialIssues()->toArray())),
'scopesText' => implode(', ', array_map(fn (Scope $s) => $this->translatableStringHelper->localize($s->getName()), $scopes)),
'hasRequestor' => $period->getRequestor() !== null,
'requestorKind' => $period->getRequestorKind(),
'hasLocation' => $period->getLocation() !== null,

View File

@@ -48,7 +48,7 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz
$initial = $this->normalizer->normalize($object, $format, array_merge(
$context,
[self::IGNORE_EVALUATION => spl_object_hash($object)],
[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => static fn($object, $format, $context) => $object->getId()]
[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => static fn ($object, $format, $context) => $object->getId()]
));
// due to bug: https://api-platform.com/docs/core/serialization/#collection-relation

View File

@@ -94,7 +94,7 @@ class PersonDocGenNormalizer implements
// we simplify the list of attributes for the embedded persons
AbstractNormalizer::GROUPS => ['docgen:read'],
// when a person reference the same person... take care of circular references
AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => fn($object, $format, $context) => $this->normalizer->normalize(null, $format, $context),
AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => fn ($object, $format, $context) => $this->normalizer->normalize(null, $format, $context),
]);
if (null === $person) {
@@ -115,7 +115,7 @@ class PersonDocGenNormalizer implements
'altNames' => implode(
', ',
array_map(
static fn(PersonAltName $altName) => $altName->getLabel(),
static fn (PersonAltName $altName) => $altName->getLabel(),
$person->getAltNames()->toArray()
)
),

View File

@@ -257,7 +257,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
{
return $altNames
->map(
static fn(PersonAltName $personAltName): array => [
static fn (PersonAltName $personAltName): array => [
'key' => $personAltName->getKey(),
'label' => $personAltName->getLabel(),
]

View File

@@ -37,7 +37,7 @@ class SocialIssueNormalizer implements ContextAwareNormalizerInterface, Normaliz
'type' => 'social_issue',
'id' => $socialIssue->getId(),
'parent_id' => $socialIssue->hasParent() ? $socialIssue->getParent()->getId() : null,
'children_ids' => $socialIssue->getChildren()->map(static fn(SocialIssue $si) => $si->getId()),
'children_ids' => $socialIssue->getChildren()->map(static fn (SocialIssue $si) => $si->getId()),
'title' => $socialIssue->getTitle(),
'text' => $this->render->renderString($socialIssue, []),
];

View File

@@ -143,10 +143,10 @@ class AccompanyingPeriodContext implements
->add('category', EntityType::class, [
'placeholder' => 'Choose a document category',
'class' => DocumentCategory::class,
'query_builder' => static fn(EntityRepository $er) => $er->createQueryBuilder('c')
'query_builder' => static fn (EntityRepository $er) => $er->createQueryBuilder('c')
->where('c.documentClass = :docClass')
->setParameter('docClass', AccompanyingCourseDocument::class),
'choice_label' => fn($entity = null) => $entity ? $this->translatableStringHelper->localize($entity->getName()) : '',
'choice_label' => fn ($entity = null) => $entity ? $this->translatableStringHelper->localize($entity->getName()) : '',
]);
}
@@ -156,7 +156,7 @@ class AccompanyingPeriodContext implements
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, mixed $entity): void
{
$options = $template->getOptions();
$persons = new ArrayCollection($entity->getCurrentParticipations()->map(static fn(AccompanyingPeriodParticipation $p) => $p->getPerson())->toArray());
$persons = new ArrayCollection($entity->getCurrentParticipations()->map(static fn (AccompanyingPeriodParticipation $p) => $p->getPerson())->toArray());
foreach ($entity->getCurrentParticipations() as $p) {
foreach ($p->getPerson()->getResources() as $r) {
@@ -181,7 +181,7 @@ class AccompanyingPeriodContext implements
$builder->add($key, EntityType::class, [
'class' => Person::class,
'choices' => $persons,
'choice_label' => fn(Person $p) => $this->personRender->renderString($p, ['addAge' => true]),
'choice_label' => fn (Person $p) => $this->personRender->renderString($p, ['addAge' => true]),
'multiple' => false,
'expanded' => true,
'required' => false,

View File

@@ -63,7 +63,7 @@ class AccompanyingPeriodWorkEvaluationContext implements
$this->accompanyingPeriodWorkContext->adminFormReverseTransform($data),
[
'evaluations' => array_map(
static fn(Evaluation $e) => $e->getId(),
static fn (Evaluation $e) => $e->getId(),
$data['evaluations']
),
]
@@ -76,7 +76,7 @@ class AccompanyingPeriodWorkEvaluationContext implements
$this->accompanyingPeriodWorkContext->adminFormTransform($data),
[
'evaluations' => array_map(
fn($id) => $this->evaluationRepository->find($id),
fn ($id) => $this->evaluationRepository->find($id),
$data['evaluations'] ?? []
),
]
@@ -93,7 +93,7 @@ class AccompanyingPeriodWorkEvaluationContext implements
'class' => Evaluation::class,
'label' => 'Linked evaluations',
'choices' => $this->evaluationRepository->findAll(),
'choice_label' => fn(Evaluation $e) => $this->translatableStringHelper->localize($e->getTitle()),
'choice_label' => fn (Evaluation $e) => $this->translatableStringHelper->localize($e->getTitle()),
'multiple' => true,
'attr' => ['class' => 'select2'],
]);

View File

@@ -126,10 +126,10 @@ final class PersonContext implements PersonContextInterface
->add('category', EntityType::class, [
'placeholder' => 'Choose a document category',
'class' => DocumentCategory::class,
'query_builder' => static fn(EntityRepository $er) => $er->createQueryBuilder('c')
'query_builder' => static fn (EntityRepository $er) => $er->createQueryBuilder('c')
->where('c.documentClass = :docClass')
->setParameter('docClass', PersonDocument::class),
'choice_label' => fn($entity = null) => $entity ? $this->translatableStringHelper->localize($entity->getName()) : '',
'choice_label' => fn ($entity = null) => $entity ? $this->translatableStringHelper->localize($entity->getName()) : '',
'required' => true,
]);
}

View File

@@ -342,7 +342,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
// check that the person id is contained
$participationsPersonsIds = array_map(
static fn($participation) => $participation->person->id,
static fn ($participation) => $participation->person->id,
$data->participations
);

View File

@@ -161,7 +161,7 @@ final class HouseholdApiControllerTest extends WebTestCase
$this->assertArrayHasKey('count', $data);
$this->assertArrayHasKey('results', $data);
$householdIds = array_map(static fn($r) => $r['id'], $data['results']);
$householdIds = array_map(static fn ($r) => $r['id'], $data['results']);
$this->assertContains($expectedHouseholdId, $householdIds);
}

View File

@@ -294,23 +294,23 @@ final class PersonControllerUpdateTest extends WebTestCase
public function validTextFieldsProvider()
{
return [
['firstName', 'random Value', static fn(Person $person) => $person->getFirstName()],
['lastName', 'random Value', static fn(Person $person) => $person->getLastName()],
['firstName', 'random Value', static fn (Person $person) => $person->getFirstName()],
['lastName', 'random Value', static fn (Person $person) => $person->getLastName()],
// reminder: this value is capitalized
['placeOfBirth', 'A PLACE', static fn(Person $person) => $person->getPlaceOfBirth()],
['birthdate', '1980-12-15', static fn(Person $person) => $person->getBirthdate()->format('Y-m-d')],
['placeOfBirth', 'A PLACE', static fn (Person $person) => $person->getPlaceOfBirth()],
['birthdate', '1980-12-15', static fn (Person $person) => $person->getBirthdate()->format('Y-m-d')],
// TODO test on phonenumber update
// ['phonenumber', '+32123456789', static function (Person $person) { return $person->getPhonenumber(); }],
['memo', 'jfkdlmq jkfldmsq jkmfdsq', static fn(Person $person) => $person->getMemo()],
['countryOfBirth', 'BE', static fn(Person $person) => $person->getCountryOfBirth()->getCountryCode()],
['nationality', 'FR', static fn(Person $person) => $person->getNationality()->getCountryCode()],
['placeOfBirth', '', static fn(Person $person) => $person->getPlaceOfBirth()],
['birthdate', '', static fn(Person $person) => $person->getBirthdate()],
['memo', 'jfkdlmq jkfldmsq jkmfdsq', static fn (Person $person) => $person->getMemo()],
['countryOfBirth', 'BE', static fn (Person $person) => $person->getCountryOfBirth()->getCountryCode()],
['nationality', 'FR', static fn (Person $person) => $person->getNationality()->getCountryCode()],
['placeOfBirth', '', static fn (Person $person) => $person->getPlaceOfBirth()],
['birthdate', '', static fn (Person $person) => $person->getBirthdate()],
//['phonenumber', '', static function (Person $person) { return $person->getPhonenumber(); }],
['memo', '', static fn(Person $person) => $person->getMemo()],
['countryOfBirth', null, static fn(Person $person) => $person->getCountryOfBirth()],
['nationality', null, static fn(Person $person) => $person->getNationality()],
['gender', Person::FEMALE_GENDER, static fn(Person $person) => $person->getGender()],
['memo', '', static fn (Person $person) => $person->getMemo()],
['countryOfBirth', null, static fn (Person $person) => $person->getCountryOfBirth()],
['nationality', null, static fn (Person $person) => $person->getNationality()],
['gender', Person::FEMALE_GENDER, static fn (Person $person) => $person->getGender()],
];
}

View File

@@ -197,12 +197,12 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
public function validTextFieldsProvider()
{
return [
['firstName', 'random Value', static fn(Person $person) => $person->getFirstName()],
['lastName', 'random Value', static fn(Person $person) => $person->getLastName()],
['birthdate', '15-12-1980', static fn(Person $person) => $person->getBirthdate()->format('d-m-Y')],
['memo', 'jfkdlmq jkfldmsq jkmfdsq', static fn(Person $person) => $person->getMemo()],
['birthdate', '', static fn(Person $person) => $person->getBirthdate()],
['gender', Person::FEMALE_GENDER, static fn(Person $person) => $person->getGender()],
['firstName', 'random Value', static fn (Person $person) => $person->getFirstName()],
['lastName', 'random Value', static fn (Person $person) => $person->getLastName()],
['birthdate', '15-12-1980', static fn (Person $person) => $person->getBirthdate()->format('d-m-Y')],
['memo', 'jfkdlmq jkfldmsq jkmfdsq', static fn (Person $person) => $person->getMemo()],
['birthdate', '', static fn (Person $person) => $person->getBirthdate()],
['gender', Person::FEMALE_GENDER, static fn (Person $person) => $person->getGender()],
];
}

View File

@@ -152,7 +152,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$locations = $period->getLocationHistories()->toArray();
usort($locations, static fn(AccompanyingPeriod\AccompanyingPeriodLocationHistory $a, AccompanyingPeriod\AccompanyingPeriodLocationHistory $b) => $a->getStartDate() <=> $b->getStartDate());
usort($locations, static fn (AccompanyingPeriod\AccompanyingPeriodLocationHistory $a, AccompanyingPeriod\AccompanyingPeriodLocationHistory $b) => $a->getStartDate() <=> $b->getStartDate());
$iterator = new ArrayIterator($locations);
$iterator->rewind();

View File

@@ -101,13 +101,13 @@ final class MembersEditorTest extends TestCase
$editor = $factory->createEditor($household2 = new Household());
$editor->addMovement(new DateTimeImmutable('yesterday'), $person, $positionNotSharing);
$sharings = $household->getCurrentMembers()->filter(static fn(HouseholdMember $m) => $m->getShareHousehold());
$notSharing = $household2->getCurrentMembers()->filter(static fn(HouseholdMember $m) => !$m->getShareHousehold());
$sharings = $household->getCurrentMembers()->filter(static fn (HouseholdMember $m) => $m->getShareHousehold());
$notSharing = $household2->getCurrentMembers()->filter(static fn (HouseholdMember $m) => !$m->getShareHousehold());
$this->assertCount(1, $notSharing);
$this->assertCount(1, $sharings);
$getPerson = static fn(HouseholdMember $m) => $m->getPerson();
$getPerson = static fn (HouseholdMember $m) => $m->getPerson();
$this->assertContains($person, $notSharing->map($getPerson));
}
@@ -137,13 +137,13 @@ final class MembersEditorTest extends TestCase
$editor = $factory->createEditor($household);
$editor->addMovement(new DateTimeImmutable('yesterday'), $person, $positionNotSharing);
$sharings = $household->getCurrentMembers()->filter(static fn(HouseholdMember $m) => $m->getShareHousehold());
$notSharing = $household->getCurrentMembers()->filter(static fn(HouseholdMember $m) => !$m->getShareHousehold());
$sharings = $household->getCurrentMembers()->filter(static fn (HouseholdMember $m) => $m->getShareHousehold());
$notSharing = $household->getCurrentMembers()->filter(static fn (HouseholdMember $m) => !$m->getShareHousehold());
$this->assertCount(1, $notSharing);
$this->assertCount(0, $sharings);
$getPerson = static fn(HouseholdMember $m) => $m->getPerson();
$getPerson = static fn (HouseholdMember $m) => $m->getPerson();
$this->assertContains($person, $notSharing->map($getPerson));
}

View File

@@ -318,7 +318,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
$normalizerManager = $this->prophesize(NormalizerInterface::class);
$normalizerManager->supportsNormalization(Argument::any(), 'docgen', Argument::any())->willReturn(true);
$normalizerManager->normalize(Argument::type(Person::class), 'docgen', Argument::any())
->will(static fn($args) => $normalizer->normalize($args[0], $args[1], $args[2]));
->will(static fn ($args) => $normalizer->normalize($args[0], $args[1], $args[2]));
$normalizerManager->normalize(Argument::any(), 'docgen', Argument::any())->will(
static function ($args) {
if (is_iterable($args[0])) {

View File

@@ -118,7 +118,7 @@ final class RelationshipDocGenNormalizerTest extends TestCase
{
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
$translatableStringHelper->localize(Argument::type('array'))->will(
static fn($args) => $args[0][array_keys($args[0])[0]]
static fn ($args) => $args[0][array_keys($args[0])[0]]
);
$normalizer = new RelationshipDocGenNormalizer(
@@ -128,7 +128,7 @@ final class RelationshipDocGenNormalizerTest extends TestCase
$normalizerManager = $this->prophesize(NormalizerInterface::class);
$normalizerManager->supportsNormalization(Argument::any(), 'docgen', Argument::any())->willReturn(true);
$normalizerManager->normalize(Argument::type(Relationship::class), 'docgen', Argument::any())
->will(static fn($args) => $normalizer->normalize($args[0], $args[1], $args[2]));
->will(static fn ($args) => $normalizer->normalize($args[0], $args[1], $args[2]));
$normalizerManager->normalize(Argument::any(), 'docgen', Argument::any())->will(
static function ($args) {
if (null === $args[0]) {

View File

@@ -263,7 +263,7 @@ final class PersonContextTest extends TestCase
if (null === $translatableStringHelper) {
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
// return only the 'fr' key
$translatableStringHelper->localize(Argument::type('array'))->will(static fn($args) => $args[0]['fr']);
$translatableStringHelper->localize(Argument::type('array'))->will(static fn ($args) => $args[0]['fr']);
$translatableStringHelper = $translatableStringHelper->reveal();
}

View File

@@ -70,7 +70,7 @@ final class PersonContextWithThirdPartyTest extends KernelTestCase
{
$normalizer = $this->prophesize(NormalizerInterface::class);
$normalizer->normalize(Argument::type(ThirdParty::class), 'docgen', Argument::type('array'))
->will(static fn($args): array => ['class' => '3party', 'hash' => spl_object_hash($args[0])]);
->will(static fn ($args): array => ['class' => '3party', 'hash' => spl_object_hash($args[0])]);
$personContext = $this->prophesize(PersonContextInterface::class);

View File

@@ -74,7 +74,7 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator
$periodIssuesWithAncestors = array_merge(
$periodIssuesWithAncestors,
array_map(
static fn(SocialIssue $si) => spl_object_hash($si),
static fn (SocialIssue $si) => spl_object_hash($si),
$si->getAncestors(true)
)
);