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.
This commit is contained in:
Julien Fastré 2025-04-08 12:38:38 +02:00
parent d9251239f7
commit ec5f4ed1d6
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 6 additions and 2 deletions

View File

@ -94,7 +94,7 @@ interface AggregatorInterface extends ModifierInterface
* @param string $key The column key, as added in the query * @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') * @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; public function getLabels($key, array $values, mixed $data): callable;

View File

@ -11,6 +11,9 @@ declare(strict_types=1);
namespace Chill\MainBundle\Export; namespace Chill\MainBundle\Export;
use Doctrine\ORM\NativeQuery;
use Doctrine\ORM\QueryBuilder;
/** /**
* Define methods to export list. * Define methods to export list.
* *
@ -20,7 +23,8 @@ namespace Chill\MainBundle\Export;
* *
* When used, the `ExportManager` will not handle aggregator for this class. * When used, the `ExportManager` will not handle aggregator for this class.
* *
* @template Q of QueryBuilder|NativeQuery
* @template D of array * @template D of array
* @template-implements ExportInterface<D> * @template-extends ExportInterface<Q, D>
*/ */
interface ListInterface extends ExportInterface {} interface ListInterface extends ExportInterface {}