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

@@ -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'],