Rename getVersion to getNormalizationVersion.

This change improves clarity by making the method name more descriptive and aligned with its purpose. All relevant interfaces, classes, and tests have been updated accordingly to reflect this renaming.
This commit is contained in:
Julien Fastré 2025-03-10 21:37:32 +01:00
parent 4fc433cd63
commit 229f9b7125
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
8 changed files with 14 additions and 14 deletions

View File

@ -35,7 +35,7 @@ interface AggregatorInterface extends ModifierInterface
public function denormalizeFormData(array $formData, int $fromVersion): array;
public function getVersion(): int;
public function getNormalizationVersion(): int;
/**
* get a callable which will be able to transform the results into

View File

@ -38,7 +38,7 @@ class ExportConfigNormalizer
$serialized = [
'export' => [
'form' => $export->normalizeFormData($exportData),
'version' => $export->getVersion(),
'version' => $export->getNormalizationVersion(),
],
];
@ -53,7 +53,7 @@ class ExportConfigNormalizer
$filtersSerialized[$alias][FilterType::ENABLED_FIELD] = (bool) $filterData[FilterType::ENABLED_FIELD];
if ($filterData[FilterType::ENABLED_FIELD]) {
$filtersSerialized[$alias]['form'] = $filter->normalizeFormData($filterData['form']);
$filtersSerialized[$alias]['version'] = $filter->getVersion();
$filtersSerialized[$alias]['version'] = $filter->getNormalizationVersion();
}
}
@ -65,7 +65,7 @@ class ExportConfigNormalizer
$aggregatorsSerialized[$alias][FilterType::ENABLED_FIELD] = (bool) $aggregatorData[AggregatorType::ENABLED_FIELD];
if ($aggregatorData[AggregatorType::ENABLED_FIELD]) {
$aggregatorsSerialized[$alias]['form'] = $aggregator->normalizeFormData($aggregatorData['form']);
$aggregatorsSerialized[$alias]['version'] = $aggregator->getVersion();
$aggregatorsSerialized[$alias]['version'] = $aggregator->getNormalizationVersion();
}
}
$serialized['aggregators'] = $aggregatorsSerialized;
@ -73,7 +73,7 @@ class ExportConfigNormalizer
$serialized['pick_formatter'] = $formData['pick_formatter'];
$formatter = $this->exportManager->getFormatter($formData['pick_formatter']);
$serialized['formatter']['form'] = $formatter->normalizeFormData($formData['formatter']['form']);
$serialized['formatter']['version'] = $formatter->getVersion();
$serialized['formatter']['version'] = $formatter->getNormalizationVersion();
return $serialized;
}

View File

@ -153,7 +153,7 @@ interface ExportInterface extends ExportElementInterface
public function denormalizeFormData(array $formData, int $fromVersion): array;
public function getVersion(): int;
public function getNormalizationVersion(): int;
/**
* Return the required Role to execute the Export.

View File

@ -42,7 +42,7 @@ interface FilterInterface extends ModifierInterface
public function denormalizeFormData(array $formData, int $fromVersion): array;
public function getVersion(): int;
public function getNormalizationVersion(): int;
/**
* Describe the filtering action.

View File

@ -70,5 +70,5 @@ interface FormatterInterface
public function denormalizeFormData(array $formData, int $fromVersion): array;
public function getVersion(): int;
public function getNormalizationVersion(): int;
}

View File

@ -36,23 +36,23 @@ class ExportConfigNormalizerTest extends TestCase
{
$filterEnabled = $this->prophesize(FilterInterface::class);
$filterEnabled->normalizeFormData(['test' => '0'])->shouldBeCalled()->willReturn(['test' => '0']);
$filterEnabled->getVersion()->willReturn(1);
$filterEnabled->getNormalizationVersion()->willReturn(1);
$filterDisabled = $this->prophesize(FilterInterface::class);
$filterDisabled->normalizeFormData(['default' => '0'])->shouldNotBeCalled();
$aggregatorEnabled = $this->prophesize(AggregatorInterface::class);
$aggregatorEnabled->normalizeFormData(['test' => '0'])->shouldBeCalled()->willReturn(['test' => '0']);
$aggregatorEnabled->getVersion()->willReturn(1);
$aggregatorEnabled->getNormalizationVersion()->willReturn(1);
$aggregatorDisabled = $this->prophesize(AggregatorInterface::class);
$aggregatorDisabled->normalizeFormData(['default' => '0'])->shouldNotBeCalled();
$export = $this->prophesize(ExportInterface::class);
$export->normalizeFormData(['test' => '0'])->shouldBeCalled()->willReturn(['test' => '0']);
$export->getVersion()->willReturn(1);
$export->getNormalizationVersion()->willReturn(1);
$formatter = $this->prophesize(FormatterInterface::class);
$formatter->normalizeFormData(['test' => '0'])->shouldBeCalled()->willReturn(['test' => '0']);
$formatter->getVersion()->willReturn(1);
$formatter->getNormalizationVersion()->willReturn(1);
$exportManager = $this->prophesize(ExportManager::class);
$exportManager->getFormatter('xlsx')->shouldBeCalled()->willReturn($formatter->reveal());

View File

@ -111,7 +111,7 @@ class StepFilterOnDate implements FilterInterface
];
}
public function getVersion(): int
public function getNormalizationVersion(): int
{
return 1;
}

View File

@ -144,7 +144,7 @@ final readonly class UserJobFilter implements FilterInterface, DataTransformerIn
];
}
public function getVersion(): int
public function getNormalizationVersion(): int
{
return 1;
}