From 1f4bef754dec9ea9233a887455ee468e538aba50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 17 Jun 2024 17:29:16 +0200 Subject: [PATCH] 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. --- .../ChillMainBundle/Form/Type/Export/AggregatorType.php | 4 +--- src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php | 4 +--- .../Tests/DependencyInjection/ChillReportExtensionTest.php | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php index 89d4586ce..72e501108 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/AggregatorType.php @@ -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), )); } diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php index 5ac876bfe..a968f4aa2 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/FilterType.php @@ -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), )); } diff --git a/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php b/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php index ae01d8d90..db938f0bf 100644 --- a/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php +++ b/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php @@ -41,7 +41,7 @@ final class ChillReportExtensionTest extends KernelTestCase } if (!$reportFounded) { - throw new \Exception('Class Chill\\ReportBundle\\Entity\\Report not found in chill_custom_fields.customizables_entities', 1); + throw new \Exception('Class Chill\ReportBundle\Entity\Report not found in chill_custom_fields.customizables_entities', 1); } } }