mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
DX: fix cs
This commit is contained in:
@@ -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')
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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')
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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')
|
||||
|
@@ -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')
|
||||
|
@@ -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)) {
|
||||
|
@@ -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,
|
||||
|
@@ -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,
|
||||
|
@@ -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) {
|
||||
|
@@ -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])
|
||||
));
|
||||
}
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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());
|
||||
|
@@ -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') . ')' : ''),
|
||||
]
|
||||
);
|
||||
|
@@ -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()),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@@ -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
|
||||
);
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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) {
|
||||
|
@@ -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']
|
||||
);
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user