mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
DX: rector rules upt to PHP 74
This commit is contained in:
@@ -169,9 +169,7 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
$accompanyingPeriods = $person->getCurrentAccompanyingPeriods();
|
||||
$accompanyingPeriodsChecked = array_filter(
|
||||
$accompanyingPeriods,
|
||||
function (AccompanyingPeriod $period) {
|
||||
return $this->isGranted(AccompanyingPeriodVoter::SEE, $period);
|
||||
}
|
||||
fn(AccompanyingPeriod $period) => $this->isGranted(AccompanyingPeriodVoter::SEE, $period)
|
||||
);
|
||||
|
||||
return $this->json(array_values($accompanyingPeriodsChecked), Response::HTTP_OK, [], ['groups' => ['read']]);
|
||||
|
@@ -222,14 +222,10 @@ class AccompanyingPeriodController extends AbstractController
|
||||
$accompanyingPeriodsRaw = $this->accompanyingPeriodACLAwareRepository
|
||||
->findByPerson($person, AccompanyingPeriodVoter::SEE);
|
||||
|
||||
usort($accompanyingPeriodsRaw, static function ($a, $b) {
|
||||
return $b->getOpeningDate() > $a->getOpeningDate();
|
||||
});
|
||||
usort($accompanyingPeriodsRaw, static fn($a, $b) => $b->getOpeningDate() > $a->getOpeningDate());
|
||||
|
||||
// filter visible or not visible
|
||||
$accompanyingPeriods = array_filter($accompanyingPeriodsRaw, function (AccompanyingPeriod $ap) {
|
||||
return $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,
|
||||
@@ -331,9 +327,7 @@ class AccompanyingPeriodController extends AbstractController
|
||||
/** @var AccompanyingPeriod $period */
|
||||
$period = array_filter(
|
||||
$person->getAccompanyingPeriods(),
|
||||
static function (AccompanyingPeriod $p) use ($period_id) {
|
||||
return $p->getId() === ($period_id);
|
||||
}
|
||||
static fn(AccompanyingPeriod $p) => $p->getId() === ($period_id)
|
||||
)[0] ?? null;
|
||||
|
||||
if (null === $period) {
|
||||
|
@@ -105,12 +105,8 @@ class AccompanyingPeriodRegulationListController
|
||||
$builder
|
||||
->add('services', EntityType::class, [
|
||||
'class' => Scope::class,
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('s');
|
||||
},
|
||||
'choice_label' => function (Scope $s) {
|
||||
return $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,
|
||||
@@ -123,9 +119,7 @@ class AccompanyingPeriodRegulationListController
|
||||
|
||||
return $qb;
|
||||
},
|
||||
'choice_label' => function (UserJob $j) {
|
||||
return $this->translatableStringHelper->localize($j->getLabel());
|
||||
},
|
||||
'choice_label' => fn(UserJob $j) => $this->translatableStringHelper->localize($j->getLabel()),
|
||||
'multiple' => true,
|
||||
'label' => 'Métier',
|
||||
'required' => false,
|
||||
@@ -147,9 +141,7 @@ class AccompanyingPeriodRegulationListController
|
||||
|
||||
return $qb;
|
||||
},
|
||||
'choice_label' => static function (Location $l) {
|
||||
return $l->getName();
|
||||
},
|
||||
'choice_label' => static fn(Location $l) => $l->getName(),
|
||||
'multiple' => true,
|
||||
'group_by' => function (Location $l) {
|
||||
if (null === $type = $l->getLocationType()) {
|
||||
|
@@ -164,9 +164,7 @@ class HouseholdCompositionController extends AbstractController
|
||||
$isEdit = $request->query->has('edit');
|
||||
|
||||
if ($isEdit) {
|
||||
$householdCompositions = $household->getCompositions()->filter(static function (HouseholdComposition $composition) use ($request) {
|
||||
return $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');
|
||||
|
@@ -81,9 +81,7 @@ class HouseholdController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
usort($accompanyingPeriods, static function ($a, $b) {
|
||||
return $b->getOpeningDate() <=> $a->getOpeningDate();
|
||||
});
|
||||
usort($accompanyingPeriods, static fn($a, $b) => $b->getOpeningDate() <=> $a->getOpeningDate());
|
||||
|
||||
$oldMembers = $household->getNonCurrentMembers();
|
||||
$accompanyingPeriodsOld = [];
|
||||
|
@@ -108,14 +108,10 @@ class PersonApiController extends ApiController
|
||||
$addresses = $person
|
||||
->getAccompanyingPeriodParticipations()
|
||||
->filter(
|
||||
static function (AccompanyingPeriodParticipation $accompanyingPeriodParticipation): bool {
|
||||
return null !== $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation();
|
||||
}
|
||||
static fn(AccompanyingPeriodParticipation $accompanyingPeriodParticipation): bool => null !== $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation()
|
||||
)
|
||||
->map(
|
||||
static function (AccompanyingPeriodParticipation $accompanyingPeriodParticipation): ?Address {
|
||||
return $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation();
|
||||
}
|
||||
static fn(AccompanyingPeriodParticipation $accompanyingPeriodParticipation): ?Address => $accompanyingPeriodParticipation->getAccompanyingPeriod()->getAddressLocation()
|
||||
)
|
||||
->filter(
|
||||
// We remove potential null addresses.
|
||||
|
@@ -44,9 +44,7 @@ class SocialWorkSocialActionApiController extends ApiController
|
||||
|
||||
$socialActions = $socialIssue->getRecursiveSocialActions()->toArray();
|
||||
|
||||
usort($socialActions, static function (SocialAction $sa, SocialAction $sb) {
|
||||
return $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
|
||||
|
Reference in New Issue
Block a user