Add explicit return types and TranslatableInterface support

Updated interfaces to include explicit return types for improved type safety and readability. Integrated support for Symfony's TranslatableInterface in relevant methods to enhance translation handling.
This commit is contained in:
2025-04-07 12:56:37 +02:00
parent 2482dcc62e
commit 8331a836f2
8 changed files with 72 additions and 34 deletions

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Export;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatableInterface;
/**
* @method generate($result, $formatterData, string $exportAlias, array $exportData, array $filtersData, array $aggregatorsData): FormattedExportGeneration
@@ -33,16 +34,16 @@ interface FormatterInterface
*/
public function buildForm(
FormBuilderInterface $builder,
$exportAlias,
string $exportAlias,
array $aggregatorAliases,
);
): void;
/**
* get the default data for the form build by buildForm.
*/
public function getFormDefaultData(array $aggregatorAliases): array;
public function getName();
public function getName(): string|TranslatableInterface;
/**
* Generate a response from the data collected on differents ExportElementInterface.
@@ -54,6 +55,8 @@ interface FormatterInterface
* @param array $aggregatorsData an array containing the aggregators data. The key are the filters id, and the value are the data
*
* @return \Symfony\Component\HttpFoundation\Response The response to be shown
*
* @deprecated use generate instead
*/
public function getResponse(
$result,
@@ -64,7 +67,7 @@ interface FormatterInterface
array $aggregatorsData,
);
public function getType();
public function getType(): string;
public function normalizeFormData(array $formData): array;