From ec5f4ed1d654d7deac8ba544ab75bb888a239ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 8 Apr 2025 12:38:38 +0200 Subject: [PATCH] Refactor type annotations in export interfaces Updated return type annotations in `AggregatorInterface` for clarity and adjusted generics in `ListInterface` to better reflect supported query types. This improves code readability and strengthens type safety. --- src/Bundle/ChillMainBundle/Export/AggregatorInterface.php | 2 +- src/Bundle/ChillMainBundle/Export/ListInterface.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php b/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php index 98fca1de2..e905a6bd0 100644 --- a/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php +++ b/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php @@ -94,7 +94,7 @@ interface AggregatorInterface extends ModifierInterface * @param string $key The column key, as added in the query * @param mixed[] $values The values from the result. if there are duplicates, those might be given twice. Example: array('FR', 'BE', 'CZ', 'FR', 'BE', 'FR') * - * @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(); }` + * @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; diff --git a/src/Bundle/ChillMainBundle/Export/ListInterface.php b/src/Bundle/ChillMainBundle/Export/ListInterface.php index d23cce0c0..863a57c8d 100644 --- a/src/Bundle/ChillMainBundle/Export/ListInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ListInterface.php @@ -11,6 +11,9 @@ declare(strict_types=1); namespace Chill\MainBundle\Export; +use Doctrine\ORM\NativeQuery; +use Doctrine\ORM\QueryBuilder; + /** * Define methods to export list. * @@ -20,7 +23,8 @@ namespace Chill\MainBundle\Export; * * When used, the `ExportManager` will not handle aggregator for this class. * + * @template Q of QueryBuilder|NativeQuery * @template D of array - * @template-implements ExportInterface + * @template-extends ExportInterface */ interface ListInterface extends ExportInterface {}