diff --git a/.github/workflows/code_samples.yaml b/.github/workflows/code_samples.yaml index 5ab0edcf371..d410a86455d 100644 --- a/.github/workflows/code_samples.yaml +++ b/.github/workflows/code_samples.yaml @@ -10,7 +10,8 @@ jobs: strategy: matrix: php: - - "8.3" + - "8.4" # Upper supported version + - "8.3" # Lower supported version steps: - uses: actions/checkout@v4 @@ -46,11 +47,11 @@ jobs: - name: Run PHPStan analysis run: composer phpstan - - name: Deptrac + - name: Run Deptrac analysis run: composer deptrac - - name: Run rector - run: vendor/bin/rector process --dry-run --ansi + - name: Run Rector check + run: composer check-rector code-samples-inclusion-check: name: Check code samples inclusion diff --git a/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php b/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php index 86d37860e96..8291280647c 100644 --- a/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php +++ b/code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php @@ -16,7 +16,7 @@ class ProductSuggestionNormalizer implements /** * @return array */ - public function normalize($object, string $format = null, array $context = []): array + public function normalize($object, ?string $format = null, array $context = []): array { /** @var \App\Search\Model\Suggestion\ProductSuggestion $object */ return [ diff --git a/code_samples/data_migration/src/Migrations/Action/AssignSectionDenormalizer.php b/code_samples/data_migration/src/Migrations/Action/AssignSectionDenormalizer.php index a8b914701fc..96f067a99e8 100644 --- a/code_samples/data_migration/src/Migrations/Action/AssignSectionDenormalizer.php +++ b/code_samples/data_migration/src/Migrations/Action/AssignSectionDenormalizer.php @@ -9,7 +9,7 @@ final class AssignSectionDenormalizer extends AbstractActionDenormalizer { - protected function supportsActionName(string $actionName, string $format = null): bool + protected function supportsActionName(string $actionName, ?string $format = null): bool { return $actionName === AssignSection::TYPE; } @@ -22,7 +22,7 @@ protected function supportsActionName(string $actionName, string $format = null) * * @return \App\Migrations\Action\AssignSection */ - public function denormalize($data, string $type, string $format = null, array $context = []): AssignSection + public function denormalize($data, string $type, ?string $format = null, array $context = []): AssignSection { Assert::keyExists($data, 'value'); diff --git a/code_samples/data_migration/src/Migrations/Step/ReplaceNameStepNormalizer.php b/code_samples/data_migration/src/Migrations/Step/ReplaceNameStepNormalizer.php index 54249074267..55b5ace82d9 100644 --- a/code_samples/data_migration/src/Migrations/Step/ReplaceNameStepNormalizer.php +++ b/code_samples/data_migration/src/Migrations/Step/ReplaceNameStepNormalizer.php @@ -14,7 +14,7 @@ final class ReplaceNameStepNormalizer extends AbstractStepNormalizer { protected function normalizeStep( StepInterface $object, - string $format = null, + ?string $format = null, array $context = [] ): array { assert($object instanceof ReplaceNameStep); diff --git a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php index 96b2b844970..f4037480158 100644 --- a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php +++ b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueDenormalizer.php @@ -8,7 +8,7 @@ final class ValueDenormalizer implements DenormalizerInterface { - public function denormalize($data, string $class, string $format = null, array $context = []): mixed + public function denormalize($data, string $class, ?string $format = null, array $context = []): mixed { if (isset($data['x']) && isset($data['y'])) { // Support for old format diff --git a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php index c21c39b2118..bc7fea2b9c6 100644 --- a/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php +++ b/code_samples/field_types/2dpoint_ft/src/Serializer/Point2D/ValueNormalizer.php @@ -11,7 +11,7 @@ final class ValueNormalizer implements NormalizerInterface /** * @return array */ - public function normalize($object, string $format = null, array $context = []): array + public function normalize($object, ?string $format = null, array $context = []): array { return [ $object->getX(), diff --git a/composer.json b/composer.json index a55f3ca6ce2..1f8cb44b1e2 100644 --- a/composer.json +++ b/composer.json @@ -88,13 +88,15 @@ "fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", "check-cs": "@fix-cs --dry-run", "phpstan": "phpstan analyse", - "deptrac": "deptrac analyse" + "deptrac": "deptrac analyse", + "check-rector": "rector process --dry-run --ansi" }, "scripts-descriptions": { "fix-cs": "Automatically fixes code style in all files", "check-cs": "Run code style checker for all files", "phpstan": "Run static code analysis", - "deptrac": "Run Deptrac architecture testing" + "deptrac": "Run Deptrac architecture testing", + "check-rector": "Check for code refactoring opportunities" }, "config": { "allow-plugins": false