DX: rector rules upt to PHP 74

This commit is contained in:
2023-04-15 00:20:19 +02:00
parent a68190f0c6
commit 858ade467c
213 changed files with 433 additions and 1052 deletions

View File

@@ -58,9 +58,7 @@ class CustomFieldLongChoice extends AbstractCustomField
$translatableStringHelper = $this->translatableStringHelper;
$builder->add($customField->getSlug(), Select2ChoiceType::class, [
'choices' => $entries,
'choice_label' => static function (Option $option) use ($translatableStringHelper) {
return $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,8 +57,6 @@ class OptionRepository extends EntityRepository
->getQuery()
->getScalarResult();
return array_map(static function ($r) {
return $r['key'];
}, $keys);
return array_map(static fn($r) => $r['key'], $keys);
}
}

View File

@@ -70,9 +70,7 @@ class CustomFieldType extends AbstractType
if ('entity' === $options['group_widget']) {
$builder->add('customFieldsGroup', EntityType::class, [
'class' => 'ChillCustomFieldsBundle:CustomFieldsGroup',
'choice_label' => function ($g) {
return $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,9 +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 function ($e) {
return $e->getLabel();
},
static fn($e) => $e->getLabel(),
$customFields
);