Refactor callback functions to arrow functions

The callback functions used in the addViewTransformer method in FilterType.php and AggregatorType.php were replaced with shorter arrow functions. This change was made to increase code readability and encourage consistency throughout the codebase.
This commit is contained in:
2024-06-17 17:29:16 +02:00
parent 19e34d5dc0
commit 1f4bef754d
3 changed files with 3 additions and 7 deletions

View File

@@ -42,9 +42,7 @@ class AggregatorType extends AbstractType
if ($aggregator instanceof DataTransformerInterface) {
$aggregatorFormBuilder->addViewTransformer(new CallbackTransformer(
fn (?array $data) => $data,
function (?array $data) use ($aggregator) {
return $aggregator->transformData($data);
},
fn (?array $data) => $aggregator->transformData($data),
));
}

View File

@@ -48,9 +48,7 @@ class FilterType extends AbstractType
if ($filter instanceof DataTransformerInterface) {
$filterFormBuilder->addViewTransformer(new CallbackTransformer(
fn (?array $data) => $data,
function (?array $data) use ($filter) {
return $filter->transformData($data);
},
fn (?array $data) => $filter->transformData($data),
));
}