From 6f1a26742d3e61d639a1b827a7867a9c5593eca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 8 Apr 2025 13:40:05 +0200 Subject: [PATCH] Refactor method signatures for stricter type safety Updated method parameters to enforce stricter type declarations, improving code clarity and reducing potential runtime errors. This change ensures better consistency across interfaces and aligns with modern PHP typing practices. --- src/Bundle/ChillMainBundle/Export/AggregatorInterface.php | 2 +- src/Bundle/ChillMainBundle/Export/ExportInterface.php | 2 +- src/Bundle/ChillMainBundle/Export/FormatterInterface.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php b/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php index e905a6bd0..882ebd245 100644 --- a/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php +++ b/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php @@ -96,7 +96,7 @@ interface AggregatorInterface extends ModifierInterface * * @return callable(mixed $value): (string|int|\DateTimeInterface|TranslatableInterface) where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }` */ - public function getLabels($key, array $values, mixed $data): callable; + public function getLabels(string $key, array $values, mixed $data): callable; /** * give the list of keys the current export added to the queryBuilder in diff --git a/src/Bundle/ChillMainBundle/Export/ExportInterface.php b/src/Bundle/ChillMainBundle/Export/ExportInterface.php index 02338d7cb..c0fe0b3fa 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ExportInterface.php @@ -101,7 +101,7 @@ interface ExportInterface extends ExportElementInterface * * @return (callable(string|int|float|'_header'|null $value): string|int|\DateTimeInterface|TranslatableInterface) where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }` */ - public function getLabels($key, array $values, mixed $data); + public function getLabels(string $key, array $values, mixed $data); /** * give the list of keys the current export added to the queryBuilder in diff --git a/src/Bundle/ChillMainBundle/Export/FormatterInterface.php b/src/Bundle/ChillMainBundle/Export/FormatterInterface.php index 41c08ae37..e45549758 100644 --- a/src/Bundle/ChillMainBundle/Export/FormatterInterface.php +++ b/src/Bundle/ChillMainBundle/Export/FormatterInterface.php @@ -59,9 +59,9 @@ interface FormatterInterface * @deprecated use generate instead */ public function getResponse( - $result, - $formatterData, - $exportAlias, + array $result, + array $formatterData, + string $exportAlias, array $exportData, array $filtersData, array $aggregatorsData,