DX: fix cs

This commit is contained in:
Julien Fastré 2023-04-15 00:43:55 +02:00
parent 80647147ee
commit 746ed4f5e5
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
188 changed files with 309 additions and 308 deletions

View File

@ -59,7 +59,7 @@ class Configuration implements ConfigurationInterface
->info('The number of seconds of this duration. Must be an integer.')
->cannotBeEmpty()
->validate()
->ifTrue(static fn($data) => !is_int($data))->thenInvalid('The value %s is not a valid integer')
->ifTrue(static fn ($data) => !is_int($data))->thenInvalid('The value %s is not a valid integer')
->end()
->end()
->scalarNode('label')

View File

@ -86,7 +86,7 @@ class AvgActivityDuration 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->repository->createQueryBuilder('activity');

View File

@ -87,7 +87,7 @@ class AvgActivityVisitDuration implements ExportInterface, 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->repository->createQueryBuilder('activity');

View File

@ -86,7 +86,7 @@ class CountActivity 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->repository
->createQueryBuilder('activity')

View File

@ -109,7 +109,7 @@ class ListActivity 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

@ -87,7 +87,7 @@ class SumActivityDuration 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->repository
->createQueryBuilder('activity')

View File

@ -87,7 +87,7 @@ class SumActivityVisitDuration implements ExportInterface, 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->repository
->createQueryBuilder('activity')

View File

@ -137,7 +137,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
$activity = $activityRepository->find($value);
return implode(', ', array_map(fn(ActivityReason $r) => '"' .
return implode(', ', array_map(fn (ActivityReason $r) => '"' .
$this->translatableStringHelper->localize($r->getCategory()->getName())
. ' > ' .
$this->translatableStringHelper->localize($r->getName())
@ -195,7 +195,7 @@ class ListActivity 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);
// throw an error if any fields are present
if (!array_key_exists('fields', $data)) {

View File

@ -61,7 +61,7 @@ class ActivityTypeFilter implements FilterInterface
$builder->add('accepted_activitytypes', EntityType::class, [
'class' => ActivityType::class,
'choices' => $this->activityTypeRepository->findAllActive(),
'choice_label' => fn(ActivityType $aty) => ($aty->hasCategory() ? $this->translatableStringHelper->localize($aty->getCategory()->getName()) . ' > ' : '')
'choice_label' => fn (ActivityType $aty) => ($aty->hasCategory() ? $this->translatableStringHelper->localize($aty->getCategory()->getName()) . ' > ' : '')
.
$this->translatableStringHelper->localize($aty->getName()),
'multiple' => true,

View File

@ -64,7 +64,7 @@ class UserScopeFilter implements FilterInterface
{
$builder->add('accepted_userscope', 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

@ -61,7 +61,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
$builder->add('types', EntityType::class, [
'choices' => $this->activityTypeRepository->findAllActive(),
'class' => ActivityType::class,
'choice_label' => fn(ActivityType $aty) => ($aty->hasCategory() ? $this->translatableStringHelper->localize($aty->getCategory()->getName()) . ' > ' : '')
'choice_label' => fn (ActivityType $aty) => ($aty->hasCategory() ? $this->translatableStringHelper->localize($aty->getCategory()->getName()) . ' > ' : '')
.
$this->translatableStringHelper->localize($aty->getName()),
'group_by' => function (ActivityType $type) {

View File

@ -211,8 +211,8 @@ class ActivityType extends AbstractType
'required' => $activityType->isRequired('attendee'),
'expanded' => true,
'class' => ActivityPresence::class,
'choice_label' => fn(ActivityPresence $activityPresence) => $this->translatableStringHelper->localize($activityPresence->getName()),
'query_builder' => static fn(EntityRepository $er) => $er->createQueryBuilder('a')
'choice_label' => fn (ActivityPresence $activityPresence) => $this->translatableStringHelper->localize($activityPresence->getName()),
'query_builder' => static fn (EntityRepository $er) => $er->createQueryBuilder('a')
->where('a.active = true'),
]);
}
@ -353,7 +353,7 @@ class ActivityType extends AbstractType
return (string) $location->getId();
},
fn(?string $id): ?Location => $this->om->getRepository(Location::class)->findOneBy(['id' => (int) $id])
fn (?string $id): ?Location => $this->om->getRepository(Location::class)->findOneBy(['id' => (int) $id])
));
}

View File

@ -45,7 +45,7 @@ class ActivityTypeType extends AbstractType
])
->add('category', EntityType::class, [
'class' => ActivityTypeCategory::class,
'choice_label' => fn(ActivityTypeCategory $activityTypeCategory) => $this->translatableStringHelper->localize($activityTypeCategory->getName()),
'choice_label' => fn (ActivityTypeCategory $activityTypeCategory) => $this->translatableStringHelper->localize($activityTypeCategory->getName()),
])
->add('ordering', NumberType::class, [
'required' => true,

View File

@ -45,7 +45,7 @@ class PickActivityReasonType extends AbstractType
$resolver->setDefaults(
[
'class' => ActivityReason::class,
'choice_label' => fn(ActivityReason $choice) => $this->reasonRender->renderString($choice, []),
'choice_label' => fn (ActivityReason $choice) => $this->reasonRender->renderString($choice, []),
'group_by' => function (ActivityReason $choice): ?string {
if (null !== $category = $choice->getCategory()) {
return $this->translatableStringHelper->localize($category->getName());

View File

@ -38,7 +38,7 @@ class TranslatableActivityReasonCategoryType extends AbstractType
$resolver->setDefaults(
[
'class' => ActivityReasonCategory::class,
'choice_label' => fn(ActivityReasonCategory $category) => $this->translatableStringHelper->localize($category->getName())
'choice_label' => fn (ActivityReasonCategory $category) => $this->translatableStringHelper->localize($category->getName())
. (!$category->getActive() ? ' (' . $this->translator->trans('inactive') . ')' : ''),
]
);

View File

@ -39,7 +39,7 @@ class TranslatableActivityType extends AbstractType
'class' => ActivityType::class,
'active_only' => true,
'choices' => $this->activityTypeRepository->findAllActive(),
'choice_label' => fn(ActivityType $type) => $this->translatableStringHelper->localize($type->getName()),
'choice_label' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getName()),
]
);
}

View File

@ -254,7 +254,7 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
$reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), ActivityVoter::SEE, $center);
// we get the ids for those scopes
$reachablesScopesId = array_map(
static fn(Scope $scope) => $scope->getId(),
static fn (Scope $scope) => $scope->getId(),
$reachableScopes
);

View File

@ -134,7 +134,7 @@ class ActivityContext implements
$builder->add($key, EntityType::class, [
'class' => Person::class,
'choices' => $persons,
'choice_label' => fn(Person $p) => $this->personRender->renderString($p, []),
'choice_label' => fn (Person $p) => $this->personRender->renderString($p, []),
'multiple' => false,
'required' => false,
'expanded' => true,

View File

@ -146,7 +146,7 @@ class ListActivitiesByAccompanyingPeriodContext implements
return array_filter(
$activities,
function ($activity) use ($user) {
$activityUsernames = array_map(static fn($user) => $user['username'], $activity['users'] ?? []);
$activityUsernames = array_map(static fn ($user) => $user['username'], $activity['users'] ?? []);
return in_array($user->getUsername(), $activityUsernames, true);
}
);
@ -157,7 +157,7 @@ class ListActivitiesByAccompanyingPeriodContext implements
return array_filter(
$works,
function ($work) use ($user) {
$workUsernames = array_map(static fn($user) => $user['username'], $work['referrers'] ?? []);
$workUsernames = array_map(static fn ($user) => $user['username'], $work['referrers'] ?? []);
return in_array($user->getUsername(), $workUsernames, true);
}

View File

@ -369,8 +369,8 @@ final class ActivityControllerTest extends WebTestCase
$center
);
$reachableScopesId = array_intersect(
array_map(static fn($s) => $s->getId(), $reachableScopesDelete),
array_map(static fn($s) => $s->getId(), $reachableScopesUpdate)
array_map(static fn ($s) => $s->getId(), $reachableScopesDelete),
array_map(static fn ($s) => $s->getId(), $reachableScopesUpdate)
);
if (count($reachableScopesId) === 0) {

View File

@ -188,7 +188,7 @@ final class ActivityTypeTest extends KernelTestCase
// map all the values in an array
$values = array_map(
static fn($choice) => $choice->value,
static fn ($choice) => $choice->value,
$view['activity']['durationTime']->vars['choices']
);

View File

@ -83,7 +83,7 @@ final class TranslatableActivityReasonTest extends TypeTestCase
$request->getLocale()->willReturn($fallbackLocale);
$requestStack->willExtend(\Symfony\Component\HttpFoundation\RequestStack::class);
$requestStack->getCurrentRequest()->will(static fn() => $request);
$requestStack->getCurrentRequest()->will(static fn () => $request);
$translator->willExtend(\Symfony\Component\Translation\Translator::class);
$translator->getFallbackLocales()->willReturn($locale);

View File

@ -132,7 +132,7 @@ class Configuration implements ConfigurationInterface
->info('The number of seconds of this duration. Must be an integer.')
->cannotBeEmpty()
->validate()
->ifTrue(static fn($data) => !is_int($data))->thenInvalid('The value %s is not a valid integer')
->ifTrue(static fn ($data) => !is_int($data))->thenInvalid('The value %s is not a valid integer')
->end()
->end()
->scalarNode('label')

View File

@ -59,7 +59,7 @@ class CountAsideActivity 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

View File

@ -52,7 +52,7 @@ class ChargeType extends AbstractType
'label' => 'Charge type',
'required' => true,
'placeholder' => $this->translator->trans('admin.form.Choose the type of charge'),
'choice_label' => fn(ChargeKind $resource) => $this->translatableStringHelper->localize($resource->getName()),
'choice_label' => fn (ChargeKind $resource) => $this->translatableStringHelper->localize($resource->getName()),
'attr' => ['class' => 'select2'],
])
->add('amount', MoneyType::class)

View File

@ -51,7 +51,7 @@ class ResourceType extends AbstractType
'label' => 'Resource type',
'required' => true,
'placeholder' => $this->translator->trans('admin.form.Choose the type of resource'),
'choice_label' => fn(ResourceKind $resource) => $this->translatableStringHelper->localize($resource->getName()),
'choice_label' => fn (ResourceKind $resource) => $this->translatableStringHelper->localize($resource->getName()),
'attr' => ['class' => 'select2'],
])
->add('amount', MoneyType::class)

View File

@ -66,7 +66,7 @@ final class SummaryBudget implements SummaryBudgetInterface
];
}
$personIds = $household->getCurrentPersons()->map(static fn(Person $p) => $p->getId());
$personIds = $household->getCurrentPersons()->map(static fn (Person $p) => $p->getId());
$ids = implode(', ', array_fill(0, count($personIds), '?'));
$parameters = [...$personIds, $household->getId()];
@ -125,14 +125,14 @@ final class SummaryBudget implements SummaryBudgetInterface
{
$keys = array_map(static fn (ChargeKind $kind) => $kind->getKind(), $this->chargeKindRepository->findAll());
return array_combine($keys, array_map(fn($kind) => ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($this->chargeKindRepository->findOneByKind($kind)->getName()), 'comment' => ''], $keys));
return array_combine($keys, array_map(fn ($kind) => ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($this->chargeKindRepository->findOneByKind($kind)->getName()), 'comment' => ''], $keys));
}
private function getEmptyResourceArray(): array
{
$keys = array_map(static fn (ResourceKind $kind) => $kind->getKind(), $this->resourceKindRepository->findAll());
return array_combine($keys, array_map(fn($kind) => ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($this->resourceKindRepository->findOneByKind($kind)->getName()), 'comment' => ''], $keys));
return array_combine($keys, array_map(fn ($kind) => ['sum' => 0.0, 'label' => $this->translatableStringHelper->localize($this->resourceKindRepository->findOneByKind($kind)->getName()), 'comment' => ''], $keys));
}
private function rowToArray(array $rows, string $kind): array

View File

@ -50,7 +50,7 @@ final class SummaryBudgetTest extends TestCase
],
]);
$queryCharges->setParameters(Argument::type('array'))
->will(static fn($args, $query) => $query);
->will(static fn ($args, $query) => $query);
$queryResources = $this->prophesize(AbstractQuery::class);
$queryResources->getResult()->willReturn([
@ -61,7 +61,7 @@ final class SummaryBudgetTest extends TestCase
],
]);
$queryResources->setParameters(Argument::type('array'))
->will(static fn($args, $query) => $query);
->will(static fn ($args, $query) => $query);
$em = $this->prophesize(EntityManagerInterface::class);
$em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class))
@ -96,7 +96,7 @@ final class SummaryBudgetTest extends TestCase
$resourceRepository->findOneByKind('misc')->willReturn($misc);
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
$translatableStringHelper->localize(Argument::type('array'))->will(static fn($arg) => $arg[0]['fr']);
$translatableStringHelper->localize(Argument::type('array'))->will(static fn ($arg) => $arg[0]['fr']);
$person = new Person();
$personReflection = new ReflectionClass($person);

View File

@ -514,7 +514,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
*/
public function getUsers(): ReadableCollection
{
return $this->getInvites()->map(static fn(Invite $i) => $i->getUser());
return $this->getInvites()->map(static fn (Invite $i) => $i->getUser());
}
public function hasCalendarRange(): bool
@ -599,7 +599,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
}
$invite = $this->invites
->filter(static fn(Invite $invite) => $invite->getUser() === $user)
->filter(static fn (Invite $invite) => $invite->getUser() === $user)
->first();
$this->removeInvite($invite);

View File

@ -61,7 +61,7 @@ class CountCalendars 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 CountCalendars 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->calendarRepository->createQueryBuilder('cal');

View File

@ -61,7 +61,7 @@ class StatCalendarAvgDuration 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

View File

@ -61,7 +61,7 @@ class StatCalendarSumDuration 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

View File

@ -58,7 +58,7 @@ class AgentFilter implements FilterInterface
{
$builder->add('accepted_agents', EntityType::class, [
'class' => User::class,
'choice_label' => fn(User $u) => $this->userRender->renderString($u, []),
'choice_label' => fn (User $u) => $this->userRender->renderString($u, []),
'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

@ -89,10 +89,10 @@ class CalendarToRemoteHandler implements MessageHandlerInterface
$newInvites = array_filter(
array_map(
fn($id) => $this->inviteRepository->find($id),
fn ($id) => $this->inviteRepository->find($id),
$calendarMessage->getNewInvitesIds(),
),
static fn(?Invite $invite) => null !== $invite
static fn (?Invite $invite) => null !== $invite
);
$this->calendarConnector->syncCalendar(

View File

@ -58,7 +58,7 @@ class CalendarMessage
$this->previousMainUserId = null !== $calendar->previousMainUser ?
$calendar->previousMainUser->getId() : null;
$this->newInvitesIds = array_map(static fn (Invite $i) => $i->getId(), $calendar->newInvites);
$this->oldInvites = array_map(static fn(Invite $i) => [
$this->oldInvites = array_map(static fn (Invite $i) => [
'inviteId' => $i->getId(),
'userId' => $i->getUser()->getId(),
'userEmail' => $i->getUser()->getEmail(),

View File

@ -121,7 +121,7 @@ class RemoteEventConverter
'subject' => '[Chill] ' .
implode(
', ',
$calendar->getPersons()->map(fn(Person $p) => $this->personRender->renderString($p, []))->toArray()
$calendar->getPersons()->map(fn (Person $p) => $this->personRender->renderString($p, []))->toArray()
),
'start' => [
'dateTime' => $calendar->getStartDate()->setTimezone($this->remoteDateTimeZone)
@ -159,7 +159,7 @@ class RemoteEventConverter
{
return [
'attendees' => $calendar->getInvites()->map(
fn(Invite $i) => $this->buildInviteToAttendee($i)
fn (Invite $i) => $this->buildInviteToAttendee($i)
)->toArray(),
];
}

View File

@ -190,17 +190,17 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
]
)->toArray();
$ids = array_map(static fn($item) => $item['id'], $bareEvents['value']);
$ids = array_map(static fn ($item) => $item['id'], $bareEvents['value']);
$existingIdsInRange = $this->calendarRangeRepository->findRemoteIdsPresent($ids);
$existingIdsInCalendar = $this->calendarRepository->findRemoteIdsPresent($ids);
return array_values(
array_map(
fn($item) => $this->remoteEventConverter->convertToRemote($item),
fn ($item) => $this->remoteEventConverter->convertToRemote($item),
// filter all event to keep only the one not in range
array_filter(
$bareEvents['value'],
static fn($item) => ((!$existingIdsInRange[$item['id']]) ?? true) && ((!$existingIdsInCalendar[$item['id']]) ?? true)
static fn ($item) => ((!$existingIdsInRange[$item['id']]) ?? true) && ((!$existingIdsInCalendar[$item['id']]) ?? true)
)
)
);
@ -595,7 +595,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
}
$this->cacheScheduleTimeForUser[$userId] = array_map(
fn($item) => $this->remoteEventConverter->convertAvailabilityToRemoteEvent($item),
fn ($item) => $this->remoteEventConverter->convertAvailabilityToRemoteEvent($item),
$response['value'][0]['scheduleItems']
);

View File

@ -114,8 +114,8 @@ final class CalendarTypeTest extends TypeTestCase
$this->assertEquals(8, $calendar->getCalendarRange()->getId());
$this->assertEquals(9, $calendar->getLocation()->getId());
$this->assertEquals(true, $calendar->getSendSMS());
$this->assertContains(2, $calendar->getUsers()->map(static fn(User $u) => $u->getId()));
$this->assertContains(3, $calendar->getUsers()->map(static fn(User $u) => $u->getId()));
$this->assertContains(2, $calendar->getUsers()->map(static fn (User $u) => $u->getId()));
$this->assertContains(3, $calendar->getUsers()->map(static fn (User $u) => $u->getId()));
}
protected function getExtensions()
@ -144,16 +144,16 @@ final class CalendarTypeTest extends TypeTestCase
) {
$transformer = $this->prophesize($classTransformer);
$transformer->transform(Argument::type('array'))
->will(static fn($args) => implode(
->will(static fn ($args) => implode(
',',
array_map(static fn($p) => $p->getId(), $args[0])
array_map(static fn ($p) => $p->getId(), $args[0])
));
$transformer->transform(Argument::exact(null))
->willReturn([]);
$transformer->transform(Argument::type(Collection::class))
->will(static fn($args) => implode(
->will(static fn ($args) => implode(
',',
array_map(static fn($p) => $p->getId(), $args[0]->toArray())
array_map(static fn ($p) => $p->getId(), $args[0]->toArray())
));
$transformer->reverseTransform(Argument::type('string'))
->will(static function ($args) use ($objClass) {
@ -183,7 +183,7 @@ final class CalendarTypeTest extends TypeTestCase
) {
$transformer = $this->prophesize($classTransformer);
$transformer->transform(Argument::type('object'))
->will(static fn($args) => (string) $args[0]->getId());
->will(static fn ($args) => (string) $args[0]->getId());
$transformer->transform(Argument::exact(null))
->willReturn('');
$transformer->reverseTransform(Argument::type('string'))

View File

@ -63,7 +63,7 @@ final class AddressConverterTest extends TestCase
{
$engine = $this->prophesize(EngineInterface::class);
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
$translatableStringHelper->localize(Argument::type('array'))->will(static fn($args): string => ($args[0] ?? ['fr' => 'not provided'])['fr'] ?? 'not provided');
$translatableStringHelper->localize(Argument::type('array'))->will(static fn ($args): string => ($args[0] ?? ['fr' => 'not provided'])['fr'] ?? 'not provided');
$addressRender = new AddressRender($engine->reveal(), $translatableStringHelper->reveal());

View File

@ -72,13 +72,13 @@ final class CalendarForShortMessageProviderTest extends TestCase
Argument::type(DateTimeImmutable::class),
Argument::type('int'),
Argument::exact(0)
)->will(static fn($args) => array_fill(0, $args[2], new Calendar()))->shouldBeCalledTimes(1);
)->will(static fn ($args) => array_fill(0, $args[2], new Calendar()))->shouldBeCalledTimes(1);
$calendarRepository->findByNotificationAvailable(
Argument::type(DateTimeImmutable::class),
Argument::type(DateTimeImmutable::class),
Argument::type('int'),
Argument::not(0)
)->will(static fn($args) => array_fill(0, $args[2] - 1, new Calendar()))->shouldBeCalledTimes(1);
)->will(static fn ($args) => array_fill(0, $args[2] - 1, new Calendar()))->shouldBeCalledTimes(1);
$em = $this->prophesize(EntityManagerInterface::class);
$em->clear()->shouldBeCalled();
@ -104,13 +104,13 @@ final class CalendarForShortMessageProviderTest extends TestCase
Argument::type(DateTimeImmutable::class),
Argument::type('int'),
Argument::exact(0)
)->will(static fn($args) => array_fill(0, 1, new Calendar()))->shouldBeCalledTimes(1);
)->will(static fn ($args) => array_fill(0, 1, new Calendar()))->shouldBeCalledTimes(1);
$calendarRepository->findByNotificationAvailable(
Argument::type(DateTimeImmutable::class),
Argument::type(DateTimeImmutable::class),
Argument::type('int'),
Argument::not(0)
)->will(static fn($args) => [])->shouldBeCalledTimes(1);
)->will(static fn ($args) => [])->shouldBeCalledTimes(1);
$em = $this->prophesize(EntityManagerInterface::class);
$em->clear()->shouldBeCalled();

View File

@ -58,7 +58,7 @@ class CustomFieldLongChoice extends AbstractCustomField
$translatableStringHelper = $this->translatableStringHelper;
$builder->add($customField->getSlug(), Select2ChoiceType::class, [
'choices' => $entries,
'choice_label' => static fn(Option $option) => $translatableStringHelper->localize($option->getText()),
'choice_label' => static fn (Option $option) => $translatableStringHelper->localize($option->getText()),
'choice_value' => static fn (Option $key): ?int => null === $key ? null : $key->getId(),
'multiple' => false,
'expanded' => false,

View File

@ -57,6 +57,6 @@ class OptionRepository extends EntityRepository
->getQuery()
->getScalarResult();
return array_map(static fn($r) => $r['key'], $keys);
return array_map(static fn ($r) => $r['key'], $keys);
}
}

View File

@ -70,7 +70,7 @@ class CustomFieldType extends AbstractType
if ('entity' === $options['group_widget']) {
$builder->add('customFieldsGroup', EntityType::class, [
'class' => 'ChillCustomFieldsBundle:CustomFieldsGroup',
'choice_label' => fn($g) => $this->translatableStringHelper->localize($g->getName()),
'choice_label' => fn ($g) => $this->translatableStringHelper->localize($g->getName()),
]);
} elseif ('hidden' === $options['group_widget']) {
$builder->add('customFieldsGroup', HiddenType::class);

View File

@ -38,7 +38,7 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
// @TODO: in the array_map callback, CustomField::getLabel() does not exist. What do we do here?
$customFieldsLablels = array_map(
static fn($e) => $e->getLabel(),
static fn ($e) => $e->getLabel(),
$customFields
);

View File

@ -61,8 +61,8 @@ class DocGeneratorTemplateType extends AbstractType
$sub = $builder
->create('options', null, ['compound' => true])
->addModelTransformer(new CallbackTransformer(
static fn(array $data) => $context->adminFormTransform($data),
static fn(array $data) => $context->adminFormReverseTransform($data)
static fn (array $data) => $context->adminFormTransform($data),
static fn (array $data) => $context->adminFormReverseTransform($data)
));
$context->buildAdminForm($sub);
$builder->add($sub);

View File

@ -72,10 +72,10 @@ class AccompanyingCourseDocumentType extends AbstractType
->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()) : '',
]);
}

View File

@ -67,10 +67,10 @@ class PersonDocumentType extends AbstractType
->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()) : '',
]);
if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) {

View File

@ -51,7 +51,7 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
$persons = [];
if (null !== $course) {
$persons = $course->getCurrentParticipations()->map(static fn(AccompanyingPeriodParticipation $participation) => $participation->getPerson())->toArray();
$persons = $course->getCurrentParticipations()->map(static fn (AccompanyingPeriodParticipation $participation) => $participation->getPerson())->toArray();
}
return [

View File

@ -113,7 +113,7 @@ class ParticipationController extends AbstractController
[
'event_id' => current($participations)->getEvent()->getId(),
'persons_ids' => implode(',', array_map(
static fn(Participation $p) => $p->getPerson()->getId(),
static fn (Participation $p) => $p->getPerson()->getId(),
$participations
)),
]
@ -648,13 +648,13 @@ class ParticipationController extends AbstractController
// create a collection of person's id participating to the event
/** @var \Doctrine\Common\Collections\ArrayCollection $peopleParticipating */
$peopleParticipating ??= $participation->getEvent()->getParticipations()->map(
static fn(Participation $p) => $p->getPerson()->getId()
static fn (Participation $p) => $p->getPerson()->getId()
);
// check that the user is not already in the event
if ($peopleParticipating->contains($participation->getPerson()->getId())) {
$ignoredParticipations[] = $participation
->getEvent()->getParticipations()->filter(
static fn(Participation $p) => $p->getPerson()->getId() === $participation->getPerson()->getId()
static fn (Participation $p) => $p->getPerson()->getId() === $participation->getPerson()->getId()
)->first();
} else {
$newParticipations[] = $participation;

View File

@ -176,7 +176,7 @@ class Event implements HasCenterInterface, HasScopeInterface
{
$iterator = $this->participations->getIterator();
$iterator->uasort(static fn($first, $second) => strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName()));
$iterator->uasort(static fn ($first, $second) => strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName()));
return $iterator;
}

View File

@ -62,7 +62,7 @@ class EventChoiceLoader implements ChoiceLoaderInterface
{
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
$this->lazyLoadedEvents,
static fn(Event $p) => call_user_func($value, $p)
static fn (Event $p) => call_user_func($value, $p)
);
}

View File

@ -38,7 +38,7 @@ class RoleType extends AbstractType
->add('active')
->add('type', EntityType::class, [
'class' => EventType::class,
'choice_label' => fn(EventType $e) => $this->translatableStringHelper->localize($e->getName()),
'choice_label' => fn (EventType $e) => $this->translatableStringHelper->localize($e->getName()),
]);
}

View File

@ -109,12 +109,12 @@ class PickEventType extends AbstractType
// add the default options
$resolver->setDefaults([
'class' => Event::class,
'choice_label' => static fn(Event $e) => $e->getDate()->format('d/m/Y, H:i') . ' → ' .
'choice_label' => static fn (Event $e) => $e->getDate()->format('d/m/Y, H:i') . ' → ' .
// $e->getType()->getName()['fr'] . ': ' . // display the type of event
$e->getName(),
'placeholder' => 'Pick an event',
'attr' => ['class' => 'select2 '],
'choice_attr' => static fn(Event $e) => ['data-center' => $e->getCenter()->getId()],
'choice_attr' => static fn (Event $e) => ['data-center' => $e->getCenter()->getId()],
'choiceloader' => function (Options $options) {
$centers = $this->filterCenters($options);
@ -139,7 +139,7 @@ class PickEventType extends AbstractType
// option role
if (null === $options['role']) {
$centers = array_map(
static fn(GroupCenter $g) => $g->getCenter(),
static fn (GroupCenter $g) => $g->getCenter(),
$this->user->getGroupCenters()->toArray()
);
} else {
@ -167,7 +167,7 @@ class PickEventType 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

@ -39,10 +39,10 @@ class PickEventTypeType extends AbstractType
$resolver->setDefaults(
[
'class' => EventType::class,
'query_builder' => static fn(EntityRepository $er) => $er->createQueryBuilder('et')
'query_builder' => static fn (EntityRepository $er) => $er->createQueryBuilder('et')
->where('et.active = true'),
'choice_label' => static fn(EventType $t) => $helper->localize($t->getName()),
'choice_attrs' => static fn(EventType $t) => ['data-link-category' => $t->getId()],
'choice_label' => static fn (EventType $t) => $helper->localize($t->getName()),
'choice_attrs' => static fn (EventType $t) => ['data-link-category' => $t->getId()],
]
);
}

View File

@ -80,7 +80,7 @@ class PickRoleType extends AbstractType
$options = $config->getOptions();
$form->getParent()->add($name, $type, array_replace($options, [
'group_by' => fn(Role $r) => $this->translatableStringHelper->localize($r->getType()->getName()),
'group_by' => fn (Role $r) => $this->translatableStringHelper->localize($r->getType()->getName()),
]));
}
}
@ -109,11 +109,11 @@ class PickRoleType extends AbstractType
'class' => Role::class,
'query_builder' => $qb,
'group_by' => null,
'choice_attr' => static fn(Role $r) => [
'choice_attr' => static fn (Role $r) => [
'data-event-type' => $r->getType()->getId(),
'data-link-category' => $r->getType()->getId(),
],
'choice_label' => static fn(Role $r) => $translatableStringHelper->localize($r->getName()) .
'choice_label' => static fn (Role $r) => $translatableStringHelper->localize($r->getName()) .
($r->getActive() === true ? '' :
' (' . $translator->trans('unactive') . ')'),
]);

View File

@ -82,7 +82,7 @@ class PickStatusType extends AbstractType
$type = $config->getType()->getName();
$options = $config->getOptions();
$form->getParent()->add($name, $type, array_replace($options, [
'group_by' => fn(Status $s) => $this->translatableStringHelper->localize($s->getType()->getName()),
'group_by' => fn (Status $s) => $this->translatableStringHelper->localize($s->getType()->getName()),
]));
}
);
@ -110,11 +110,11 @@ class PickStatusType extends AbstractType
'class' => Status::class,
'query_builder' => $qb,
'group_by' => null,
'choice_attr' => static fn(Status $s) => [
'choice_attr' => static fn (Status $s) => [
'data-event-type' => $s->getType()->getId(),
'data-link-category' => $s->getType()->getId(),
],
'choice_label' => static fn(Status $s) => $translatableStringHelper->localize($s->getName()) .
'choice_label' => static fn (Status $s) => $translatableStringHelper->localize($s->getName()) .
($s->getActive() === true ? '' :
' (' . $translator->trans('unactive') . ')'),
]);

View File

@ -239,7 +239,7 @@ final class ParticipationControllerTest extends WebTestCase
$this->personsIdsCache = array_merge(
$this->personsIdsCache,
$event->getParticipations()->map(
static fn($p) => $p->getPerson()->getId()
static fn ($p) => $p->getPerson()->getId()
)
->toArray()
);
@ -303,7 +303,7 @@ final class ParticipationControllerTest extends WebTestCase
$event = $this->getRandomEventWithMultipleParticipations();
$persons_id = implode(',', $event->getParticipations()->map(
static fn($p) => $p->getPerson()->getId()
static fn ($p) => $p->getPerson()->getId()
)->toArray());
$crawler = $this->client->request(
@ -329,7 +329,7 @@ final class ParticipationControllerTest extends WebTestCase
$nbParticipations = $event->getParticipations()->count();
// get the persons_id participating on this event
$persons_id = $event->getParticipations()->map(
static fn($p) => $p->getPerson()->getId()
static fn ($p) => $p->getPerson()->getId()
)->toArray();
// exclude the existing persons_ids from the new person
$this->personsIdsCache = array_merge($this->personsIdsCache, $persons_id);
@ -458,7 +458,7 @@ final class ParticipationControllerTest extends WebTestCase
$circles = $this->em->getRepository(\Chill\MainBundle\Entity\Scope::class)
->findAll();
array_filter($circles, static fn($circle) => in_array($circleName, $circle->getName(), true));
array_filter($circles, static fn ($circle) => in_array($circleName, $circle->getName(), true));
$circle = $circles[0];
$events = $this->em->getRepository(\Chill\EventBundle\Entity\Event::class)

View File

@ -208,7 +208,7 @@ class TimelineEventProvider implements TimelineProviderInterface
foreach ($reachableCenters as $center) {
$reachableCircleId = array_map(
static fn(Scope $scope) => $scope->getId(),
static fn (Scope $scope) => $scope->getId(),
$this->helper->getReachableCircles($this->user, $role, $person->getCenter())
);
$centerAndScopeLines[] = sprintf(

View File

@ -141,7 +141,7 @@ class CRUDRoutesLoader extends Loader
$methods = array_keys(array_filter(
$action['methods'],
static fn($value, $key) => $value,
static fn ($value, $key) => $value,
ARRAY_FILTER_USE_BOTH
));

View File

@ -282,7 +282,7 @@ class NotificationController extends AbstractController
if ($request->query->has('edit')) {
$commentId = $request->query->getInt('edit');
$editedComment = $notification->getComments()->filter(static fn(NotificationComment $c) => $c->getId() === $commentId)->first();
$editedComment = $notification->getComments()->filter(static fn (NotificationComment $c) => $c->getId() === $commentId)->first();
if (false === $editedComment) {
throw $this->createNotFoundException("Comment with id {$commentId} does not exists nor belong to this notification");

View File

@ -158,7 +158,7 @@ class PermissionsGroupController extends AbstractController
'edit_form' => $editForm->createView(),
'role_scopes_sorted' => $roleScopesSorted,
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
'delete_role_scopes_form' => array_map(static fn($form) => $form->createView(), $deleteRoleScopesForm),
'delete_role_scopes_form' => array_map(static fn ($form) => $form->createView(), $deleteRoleScopesForm),
'add_role_scopes_form' => $addRoleScopesForm->createView(),
]);
}
@ -303,7 +303,7 @@ class PermissionsGroupController extends AbstractController
'role_scopes_sorted' => $roleScopesSorted,
'edit_form' => $editForm->createView(),
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
'delete_role_scopes_form' => array_map(static fn($form) => $form->createView(), $deleteRoleScopesForm),
'delete_role_scopes_form' => array_map(static fn ($form) => $form->createView(), $deleteRoleScopesForm),
'add_role_scopes_form' => $addRoleScopesForm->createView(),
]);
}
@ -445,7 +445,7 @@ class PermissionsGroupController extends AbstractController
'role_scopes_sorted' => $roleScopesSorted,
'edit_form' => $editForm->createView(),
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
'delete_role_scopes_form' => array_map(static fn($form) => $form->createView(), $deleteRoleScopesForm),
'delete_role_scopes_form' => array_map(static fn ($form) => $form->createView(), $deleteRoleScopesForm),
'add_role_scopes_form' => $addRoleScopesForm->createView(),
]);
}
@ -567,7 +567,7 @@ class PermissionsGroupController extends AbstractController
if (!array_key_exists($roleScope->getRole(), $expandedRoles)) {
$expandedRoles[$roleScope->getRole()] =
array_map(
static fn(Role $role) => $role->getRole(),
static fn (Role $role) => $role->getRole(),
$this->roleHierarchy
->getReachableRoles(
[new Role($roleScope->getRole())]

View File

@ -337,12 +337,13 @@ class UserController extends CRUDController
[
'add_groupcenter_form' => $this->createAddLinkGroupCenterForm($entity, $request)->createView(),
'delete_groupcenter_form' => array_map(
static fn(Form $form) => $form->createView(),
static fn (Form $form) => $form->createView(),
iterator_to_array($this->getDeleteLinkGroupCenterByUser($entity, $request), true)
),
]
);
} elseif ('index' === $action) {
}
if ('index' === $action) {
return array_merge(
['allow_change_password' => $this->parameterBag->get('chill_main.access_user_change_password')],
$defaultTemplateParameters

View File

@ -345,7 +345,7 @@ class WorkflowController extends AbstractController
if ($transitionForm->isSubmitted() && $transitionForm->isValid()) {
if (!$workflow->can($entityWorkflow, $transition = $transitionForm['transition']->getData()->getName())) {
$blockers = $workflow->buildTransitionBlockerList($entityWorkflow, $transition);
$msgs = array_map(fn(TransitionBlocker $tb) => $this->translator->trans(
$msgs = array_map(fn (TransitionBlocker $tb) => $this->translator->trans(
$tb->getMessage(),
$tb->getParameters()
), iterator_to_array($blockers));

View File

@ -37,7 +37,7 @@ class MenuCompilerPass implements CompilerPassInterface
];
}
usort($services, static fn($a, $b) => $a['priority'] <=> $b['priority']);
usort($services, static fn ($a, $b) => $a['priority'] <=> $b['priority']);
foreach ($services as $service) {
$class = $container->getDefinition($service['id'])->getClass();

View File

@ -33,7 +33,7 @@ class Greatest extends FunctionNode
public function getSql(SqlWalker $sqlWalker)
{
return 'GREATEST(' . implode(', ', array_map(static fn(Node $expr) => $expr->dispatch($sqlWalker), $this->exprs)) . ')';
return 'GREATEST(' . implode(', ', array_map(static fn (Node $expr) => $expr->dispatch($sqlWalker), $this->exprs)) . ')';
}
public function parse(Parser $parser)

View File

@ -33,7 +33,7 @@ class Least extends FunctionNode
public function getSql(SqlWalker $sqlWalker)
{
return 'LEAST(' . implode(', ', array_map(static fn(Node $expr) => $expr->dispatch($sqlWalker), $this->exprs)) . ')';
return 'LEAST(' . implode(', ', array_map(static fn (Node $expr) => $expr->dispatch($sqlWalker), $this->exprs)) . ')';
}
public function parse(Parser $parser)

View File

@ -121,7 +121,7 @@ class PermissionsGroup
public function isRoleScopePresentOnce(ExecutionContextInterface $context)
{
$roleScopesId = array_map(
static fn(RoleScope $roleScope) => $roleScope->getId(),
static fn (RoleScope $roleScope) => $roleScope->getId(),
$this->getRoleScopes()->toArray()
);
$countedIds = array_count_values($roleScopesId);

View File

@ -291,7 +291,7 @@ class EntityWorkflowStep
public function removeDestEmail(string $email): self
{
$this->destEmail = array_filter($this->destEmail, static fn(string $existing) => $email !== $existing);
$this->destEmail = array_filter($this->destEmail, static fn (string $existing) => $email !== $existing);
return $this;
}

View File

@ -199,7 +199,7 @@ class CSVListFormatter implements FormatterInterface
foreach ($keys as $key) {
// get an array with all values for this key if possible
$values = array_map(static fn($v) => $v[$key], $this->result);
$values = array_map(static fn ($v) => $v[$key], $this->result);
// store the label in the labelsCache property
$this->labelsCache[$key] = $export->getLabels($key, $values, $this->exportData);
}

View File

@ -187,7 +187,7 @@ class CSVPivotedListFormatter implements FormatterInterface
foreach ($keys as $key) {
// get an array with all values for this key if possible
$values = array_map(static fn($v) => $v[$key], $this->result);
$values = array_map(static fn ($v) => $v[$key], $this->result);
// store the label in the labelsCache property
$this->labelsCache[$key] = $export->getLabels($key, $values, $this->exportData);
}

View File

@ -257,7 +257,7 @@ class ExportAddressHelper
$prefixes = array_merge(
$prefixes,
array_map(
static fn($item) => $prefix . $item,
static fn ($item) => $prefix . $item,
self::COLUMN_MAPPING[$key]
)
);

View File

@ -48,7 +48,7 @@ class PostalCodeChoiceLoader implements ChoiceLoaderInterface
{
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
$this->lazyLoadedPostalCodes,
static fn(?PostalCode $pc = null) => call_user_func($value, $pc)
static fn (?PostalCode $pc = null) => call_user_func($value, $pc)
);
}

View File

@ -37,7 +37,7 @@ class ExportPickCenterDataMapper implements DataMapperInterface
foreach ($this->regroupmentRepository->findAll() as $regroupment) {
/** @phpstan-ignore-next-line */
[$contained, $notContained] = $regroupment->getCenters()->partition(static fn(Center $center): bool => false);
[$contained, $notContained] = $regroupment->getCenters()->partition(static fn (Center $center): bool => false);
if (0 === count($notContained)) {
$pickedRegroupment[] = $regroupment;

View File

@ -42,7 +42,7 @@ class IdToEntityDataTransformer implements DataTransformerInterface
{
$this->repository = $repository;
$this->multiple = $multiple;
$this->getId = $getId ?? static fn(object $o) => $o->getId();
$this->getId = $getId ?? static fn (object $o) => $o->getId();
}
/**

View File

@ -36,11 +36,11 @@ final class LocationFormType extends AbstractType
$builder
->add('locationType', EntityType::class, [
'class' => EntityLocationType::class,
'choice_attr' => static fn(EntityLocationType $entity) => [
'choice_attr' => static fn (EntityLocationType $entity) => [
'data-address' => $entity->getAddressRequired(),
'data-contact' => $entity->getContactData(),
],
'choice_label' => fn(EntityLocationType $entity) => $this->translatableStringHelper->localize($entity->getTitle()),
'choice_label' => fn (EntityLocationType $entity) => $this->translatableStringHelper->localize($entity->getTitle()),
])
->add('name', TextType::class)
->add('phonenumber1', ChillPhoneNumberType::class, ['required' => false])

View File

@ -24,10 +24,10 @@ class ComposedGroupCenterType extends AbstractType
{
$builder->add('permissionsgroup', EntityType::class, [
'class' => \Chill\MainBundle\Entity\PermissionsGroup::class,
'choice_label' => static fn(PermissionsGroup $group) => $group->getName(),
'choice_label' => static fn (PermissionsGroup $group) => $group->getName(),
])->add('center', EntityType::class, [
'class' => \Chill\MainBundle\Entity\Center::class,
'choice_label' => static fn(Center $center) => $center->getName(),
'choice_label' => static fn (Center $center) => $center->getName(),
]);
}

View File

@ -82,11 +82,11 @@ class ComposedRoleScopeType extends AbstractType
return ['data-has-scope' => '1'];
},
'group_by' => fn($role, $key, $index) => $this->roleProvider->getRoleTitle($role),
'group_by' => fn ($role, $key, $index) => $this->roleProvider->getRoleTitle($role),
])
->add('scope', EntityType::class, [
'class' => Scope::class,
'choice_label' => static fn(Scope $scope) => $translatableStringHelper->localize($scope->getName()),
'choice_label' => static fn (Scope $scope) => $translatableStringHelper->localize($scope->getName()),
'required' => false,
'data' => null,
]);

View File

@ -51,7 +51,7 @@ class EntityToJsonTransformer implements DataTransformerInterface
}
return array_map(
fn($item) => $this->denormalizeOne($item),
fn ($item) => $this->denormalizeOne($item),
$denormalized
);
}

View File

@ -67,7 +67,7 @@ final class PickCenterType extends AbstractType
'choices' => $centers,
'multiple' => true,
'expanded' => true,
'choice_label' => static fn(Center $c) => $c->getName(),
'choice_label' => static fn (Center $c) => $c->getName(),
'data' => $centers,
]);
@ -78,7 +78,7 @@ final class PickCenterType extends AbstractType
'multiple' => true,
'expanded' => true,
'choices' => $this->regroupmentRepository->findAllActive(),
'choice_label' => static fn(Regroupment $r) => $r->getName(),
'choice_label' => static fn (Regroupment $r) => $r->getName(),
]);
}

View File

@ -90,7 +90,7 @@ class PickCenterType extends AbstractType
return ['center' => $data];
},
static fn($data) => $data['center']
static fn ($data) => $data['center']
));
}

View File

@ -34,11 +34,11 @@ class PickCivilityType extends AbstractType
->setDefault('label', 'Civility')
->setDefault(
'choice_label',
fn(Civility $civility): string => $this->translatableStringHelper->localize($civility->getName())
fn (Civility $civility): string => $this->translatableStringHelper->localize($civility->getName())
)
->setDefault(
'query_builder',
static fn(EntityRepository $er): QueryBuilder => $er->createQueryBuilder('c')
static fn (EntityRepository $er): QueryBuilder => $er->createQueryBuilder('c')
->where('c.active = true')
->orderBy('c.order'),
)

View File

@ -31,7 +31,7 @@ class PickLocationTypeType extends AbstractType
$resolver
->setDefaults([
'class' => LocationType::class,
'choice_label' => fn(LocationType $type) => $this->translatableStringHelper->localize($type->getTitle()),
'choice_label' => fn (LocationType $type) => $this->translatableStringHelper->localize($type->getTitle()),
'placeholder' => 'Pick a location type',
'required' => false,
'attr' => ['class' => 'select2'],

View File

@ -36,7 +36,7 @@ class PickUserLocationType extends AbstractType
->setDefaults([
'class' => Location::class,
'choices' => $this->locationRepository->findByPublicLocations(),
'choice_label' => fn(Location $entity) => $entity->getName() ?
'choice_label' => fn (Location $entity) => $entity->getName() ?
$entity->getName() . ' (' . $this->translatableStringHelper->localize($entity->getLocationType()->getTitle()) . ')' :
$this->translatableStringHelper->localize($entity->getLocationType()->getTitle()),
'placeholder' => 'Pick a location',

View File

@ -77,7 +77,7 @@ class PostalCodeType extends AbstractType
$helper = $this->translatableStringHelper;
$resolver
->setDefault('class', PostalCode::class)
->setDefault('choice_label', static fn(PostalCode $code) => $code->getCode() . ' ' . $code->getName() . ' [' .
->setDefault('choice_label', static fn (PostalCode $code) => $code->getCode() . ' ' . $code->getName() . ' [' .
$helper->localize($code->getCountry()->getName()) . ']')
->setDefault('choice_loader', $this->choiceLoader)
->setDefault('placeholder', 'Select a postal code');

View File

@ -66,7 +66,7 @@ class ScopePickerType extends AbstractType
$options['role'] instanceof Role ? $options['role']->getRole() : $options['role'],
$options['center']
),
static fn(Scope $s) => $s->isActive()
static fn (Scope $s) => $s->isActive()
);
if (0 === count($items)) {
@ -77,7 +77,7 @@ class ScopePickerType extends AbstractType
$builder->add('scope', EntityType::class, [
'class' => Scope::class,
'placeholder' => 'Choose the circle',
'choice_label' => fn(Scope $c) => $this->translatableStringHelper->localize($c->getName()),
'choice_label' => fn (Scope $c) => $this->translatableStringHelper->localize($c->getName()),
'choices' => $items,
]);
$builder->setDataMapper(new ScopePickerDataMapper());

View File

@ -79,7 +79,7 @@ class UserPickerType extends AbstractType
->setAllowedTypes('having_permissions_group_flag', ['string', 'null'])
->setDefault('class', User::class)
->setDefault('placeholder', 'Choose an user')
->setDefault('choice_label', fn(User $u) => $this->userRender->renderString($u, []))
->setDefault('choice_label', fn (User $u) => $this->userRender->renderString($u, []))
->setDefault('scope', null)
->setAllowedTypes('scope', [Scope::class, 'array', 'null'])
->setNormalizer('choices', function (Options $options) {

View File

@ -77,14 +77,14 @@ class UserType extends AbstractType
'required' => false,
'placeholder' => 'Choose a main scope',
'class' => Scope::class,
'choice_label' => fn(Scope $c) => $this->translatableStringHelper->localize($c->getName()),
'choice_label' => fn (Scope $c) => $this->translatableStringHelper->localize($c->getName()),
])
->add('userJob', EntityType::class, [
'label' => 'user job',
'required' => false,
'placeholder' => 'choose a job',
'class' => UserJob::class,
'choice_label' => fn(UserJob $c) => $this->translatableStringHelper->localize($c->getLabel()),
'choice_label' => fn (UserJob $c) => $this->translatableStringHelper->localize($c->getLabel()),
'query_builder' => static function (EntityRepository $er) {
$qb = $er->createQueryBuilder('uj');
$qb->where('uj.active = TRUE');
@ -97,7 +97,7 @@ class UserType extends AbstractType
'required' => false,
'placeholder' => 'choose a location',
'class' => Location::class,
'choice_label' => fn(Location $l) => $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ' - ' . $l->getName(),
'choice_label' => fn (Location $l) => $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ' - ' . $l->getName(),
'query_builder' => static function (EntityRepository $er) {
$qb = $er->createQueryBuilder('l');
$qb->orderBy('l.locationType');

View File

@ -69,7 +69,7 @@ class WorkflowStepType extends AbstractType
$choices = array_combine(
array_map(
static fn(Transition $transition) => $transition->getName(),
static fn (Transition $transition) => $transition->getName(),
$transitions
),
$transitions
@ -86,8 +86,8 @@ class WorkflowStepType extends AbstractType
'backward' => 'backward',
'neutral' => 'neutral',
],
'choice_label' => fn(string $key) => $this->translatableStringHelper->localize($inputLabels[$key]),
'choice_attr' => static fn(string $key) => [
'choice_label' => fn (string $key) => $this->translatableStringHelper->localize($inputLabels[$key]),
'choice_attr' => static fn (string $key) => [
$key => $key,
],
'mapped' => false,

View File

@ -90,7 +90,7 @@ class SearchProvider
public function getByOrder()
{
//sort the array
uasort($this->searchServices, static fn(SearchInterface $a, SearchInterface $b) => $a->getOrder() <=> $b->getOrder());
uasort($this->searchServices, static fn (SearchInterface $a, SearchInterface $b) => $a->getOrder() <=> $b->getOrder());
return $this->searchServices;
}

View File

@ -54,7 +54,7 @@ class AddressReferenceBEFromBestAddress
throw new RuntimeException('could not get the release definition', 0, $e);
}
$asset = array_filter($release['assets'], static fn(array $item) => 'addresses-' . $list . '.' . $lang . '.csv.gz' === $item['name']);
$asset = array_filter($release['assets'], static fn (array $item) => 'addresses-' . $list . '.' . $lang . '.csv.gz' === $item['name']);
return array_values($asset)[0]['browser_download_url'];
}

View File

@ -82,7 +82,7 @@ class PostalCodeBEFromBestAddress
throw new RuntimeException('could not get the release definition', 0, $e);
}
$postals = array_filter($release['assets'], static fn(array $item) => 'postals.' . $lang . '.csv.gz' === $item['name']);
$postals = array_filter($release['assets'], static fn (array $item) => 'postals.' . $lang . '.csv.gz' === $item['name']);
return array_values($postals)[0]['browser_download_url'];
}

View File

@ -39,7 +39,7 @@ class ChillMailer implements MailerInterface
}
$this->chillLogger->info('chill email sent', [
'to' => array_map(static fn(Address $address) => $address->getAddress(), $message->getTo()),
'to' => array_map(static fn (Address $address) => $address->getAddress(), $message->getTo()),
'subject' => $message->getSubject(),
]);

View File

@ -134,7 +134,7 @@ final class NotificationTest extends KernelTestCase
$this->assertEquals($senderId, $notification->getSender()->getId());
$this->assertCount(count($addressesIds), $notification->getUnreadBy());
$unreadIds = $notification->getUnreadBy()->map(static fn(User $u) => $u->getId());
$unreadIds = $notification->getUnreadBy()->map(static fn (User $u) => $u->getId());
foreach ($addressesIds as $addresseeId) {
$this->assertContains($addresseeId, $unreadIds);

View File

@ -96,7 +96,7 @@ final class ScopePickerTypeTest extends TypeTestCase
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
$translatableStringHelper->localize(Argument::type('array'))->will(
static fn($args) => $args[0]['fr']
static fn ($args) => $args[0]['fr']
);
$type = new ScopePickerType(

View File

@ -52,7 +52,7 @@ final class ExtractDateFromPatternTest extends TestCase
$this->assertContainsOnlyInstancesOf(DateTimeImmutable::class, $result->getFound());
$dates = array_map(
static fn(DateTimeImmutable $d) => $d->format('Y-m-d'),
static fn (DateTimeImmutable $d) => $d->format('Y-m-d'),
$result->getFound()
);

View File

@ -211,7 +211,7 @@ final class AuthorizationHelperTest extends KernelTestCase
$centerA
);
$usernames = array_map(static fn(User $u) => $u->getUsername(), $users);
$usernames = array_map(static fn (User $u) => $u->getUsername(), $users);
$this->assertContains('center a_social', $usernames);
}

View File

@ -105,7 +105,7 @@ class EntityWorkflowTransitionEventSubscriber implements EventSubscriberInterfac
[
'%users%' => implode(
', ',
$entityWorkflow->getCurrentStep()->getAllDestUser()->map(fn(User $u) => $this->userRender->renderString($u, []))->toArray()
$entityWorkflow->getCurrentStep()->getAllDestUser()->map(fn (User $u) => $this->userRender->renderString($u, []))->toArray()
),
]
));

View File

@ -109,7 +109,7 @@ class NotificationOnTransition implements EventSubscriberInterface
'dest' => $subscriber,
'place' => $place,
'workflow' => $workflow,
'is_dest' => in_array($subscriber->getId(), array_map(static fn(User $u) => $u->getId(), $entityWorkflow->futureDestUsers), true),
'is_dest' => in_array($subscriber->getId(), array_map(static fn (User $u) => $u->getId(), $entityWorkflow->futureDestUsers), true),
];
$notification = new Notification();

Some files were not shown because too many files have changed in this diff Show More