From 229f9b7125c9896f90506044cd5ff202c3911be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 10 Mar 2025 21:37:32 +0100 Subject: [PATCH] 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. --- src/Bundle/ChillMainBundle/Export/AggregatorInterface.php | 2 +- .../ChillMainBundle/Export/ExportConfigNormalizer.php | 8 ++++---- src/Bundle/ChillMainBundle/Export/ExportInterface.php | 2 +- src/Bundle/ChillMainBundle/Export/FilterInterface.php | 2 +- src/Bundle/ChillMainBundle/Export/FormatterInterface.php | 2 +- .../Tests/Export/ExportConfigNormalizerTest.php | 8 ++++---- .../Filter/AccompanyingCourseFilters/StepFilterOnDate.php | 2 +- .../Filter/AccompanyingCourseFilters/UserJobFilter.php | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php b/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php index ab6017d6a..8840400b6 100644 --- a/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php +++ b/src/Bundle/ChillMainBundle/Export/AggregatorInterface.php @@ -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 diff --git a/src/Bundle/ChillMainBundle/Export/ExportConfigNormalizer.php b/src/Bundle/ChillMainBundle/Export/ExportConfigNormalizer.php index fddbac7f0..a599ea71f 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportConfigNormalizer.php +++ b/src/Bundle/ChillMainBundle/Export/ExportConfigNormalizer.php @@ -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; } diff --git a/src/Bundle/ChillMainBundle/Export/ExportInterface.php b/src/Bundle/ChillMainBundle/Export/ExportInterface.php index 8658e3bff..279275a81 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ExportInterface.php @@ -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. diff --git a/src/Bundle/ChillMainBundle/Export/FilterInterface.php b/src/Bundle/ChillMainBundle/Export/FilterInterface.php index 813f9ac87..46cc6dea5 100644 --- a/src/Bundle/ChillMainBundle/Export/FilterInterface.php +++ b/src/Bundle/ChillMainBundle/Export/FilterInterface.php @@ -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. diff --git a/src/Bundle/ChillMainBundle/Export/FormatterInterface.php b/src/Bundle/ChillMainBundle/Export/FormatterInterface.php index 02e073f65..9f140ebff 100644 --- a/src/Bundle/ChillMainBundle/Export/FormatterInterface.php +++ b/src/Bundle/ChillMainBundle/Export/FormatterInterface.php @@ -70,5 +70,5 @@ interface FormatterInterface public function denormalizeFormData(array $formData, int $fromVersion): array; - public function getVersion(): int; + public function getNormalizationVersion(): int; } diff --git a/src/Bundle/ChillMainBundle/Tests/Export/ExportConfigNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Export/ExportConfigNormalizerTest.php index 3a1d9a5d6..7315bf7fb 100644 --- a/src/Bundle/ChillMainBundle/Tests/Export/ExportConfigNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Export/ExportConfigNormalizerTest.php @@ -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()); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php index 7f6a11e99..2066fb25f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/StepFilterOnDate.php @@ -111,7 +111,7 @@ class StepFilterOnDate implements FilterInterface ]; } - public function getVersion(): int + public function getNormalizationVersion(): int { return 1; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php index 6477aaa66..8b5448497 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php @@ -144,7 +144,7 @@ final readonly class UserJobFilter implements FilterInterface, DataTransformerIn ]; } - public function getVersion(): int + public function getNormalizationVersion(): int { return 1; }