From 006cba977cf44945aeaba5cb5863b26bd0520feb Mon Sep 17 00:00:00 2001 From: Djordy Koert Date: Fri, 15 Nov 2024 15:02:09 +0100 Subject: [PATCH] refactor: [5.x] finalize class (#2394) ## Description Make classes marked with `@final` final https://github.com/nelmio/NelmioApiDocBundle/issues/2215 ## What type of PR is this? (check all applicable) - [ ] Bug Fix - [ ] Feature - [x] Refactor - [ ] Deprecation - [x] Breaking Change - [ ] Documentation Update - [ ] CI ## Checklist - [ ] I have made corresponding changes to the documentation (`docs/`) - [ ] I have made corresponding changes to the changelog (`CHANGELOG.md`) --- UPGRADE-5.0.md | 14 +++++++++++++- src/Command/DumpCommand.php | 5 +---- src/PropertyDescriber/ArrayPropertyDescriber.php | 2 +- src/PropertyDescriber/BooleanPropertyDescriber.php | 2 +- .../CompoundPropertyDescriber.php | 2 +- .../DateTimePropertyDescriber.php | 2 +- src/PropertyDescriber/FloatPropertyDescriber.php | 2 +- src/PropertyDescriber/IntegerPropertyDescriber.php | 2 +- src/PropertyDescriber/ObjectPropertyDescriber.php | 2 +- src/PropertyDescriber/StringPropertyDescriber.php | 2 +- 10 files changed, 22 insertions(+), 13 deletions(-) diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index d76b0ec65..b3a7de8af 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -71,4 +71,16 @@ Future proofing for potential future changes and keeping it consistent with `des ```diff - public function supports(array $types): bool; + public function supports(array $types, array $context = []): bool; -``` \ No newline at end of file +``` + +## BC BREAK: `Nelmio\ApiDocBundle\Command` has been made final + +## BC BREAK: Made classes implementing `Nelmio\ApiDocBundle\PropertyDescriber\PropertyDescriberInterface` final +`Nelmio\ApiDocBundle\PropertyDescriber\ArrayPropertyDescriber` +`Nelmio\ApiDocBundle\PropertyDescriber\BooleanPropertyDescriber` +`Nelmio\ApiDocBundle\PropertyDescriber\DateTimePropertyDescriber` +`Nelmio\ApiDocBundle\PropertyDescriber\CompoundPropertyDescriber` +`Nelmio\ApiDocBundle\PropertyDescriber\FloatPropertyDescriber` +`Nelmio\ApiDocBundle\PropertyDescriber\IntegerPropertyDescriber` +`Nelmio\ApiDocBundle\PropertyDescriber\ObjectPropertyDescriber` +`Nelmio\ApiDocBundle\PropertyDescriber\StringPropertyDescriber` diff --git a/src/Command/DumpCommand.php b/src/Command/DumpCommand.php index b9eada346..66dccb48b 100644 --- a/src/Command/DumpCommand.php +++ b/src/Command/DumpCommand.php @@ -18,10 +18,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -/** - * @final - */ -class DumpCommand extends Command +final class DumpCommand extends Command { private RenderOpenApi $renderOpenApi; diff --git a/src/PropertyDescriber/ArrayPropertyDescriber.php b/src/PropertyDescriber/ArrayPropertyDescriber.php index 78f46e1d6..6dd5b5edc 100644 --- a/src/PropertyDescriber/ArrayPropertyDescriber.php +++ b/src/PropertyDescriber/ArrayPropertyDescriber.php @@ -17,7 +17,7 @@ use OpenApi\Annotations as OA; use Symfony\Component\PropertyInfo\Type; -class ArrayPropertyDescriber implements PropertyDescriberInterface, ModelRegistryAwareInterface, PropertyDescriberAwareInterface +final class ArrayPropertyDescriber implements PropertyDescriberInterface, ModelRegistryAwareInterface, PropertyDescriberAwareInterface { use ModelRegistryAwareTrait; use PropertyDescriberAwareTrait; diff --git a/src/PropertyDescriber/BooleanPropertyDescriber.php b/src/PropertyDescriber/BooleanPropertyDescriber.php index bc493e087..4ce2d96b5 100644 --- a/src/PropertyDescriber/BooleanPropertyDescriber.php +++ b/src/PropertyDescriber/BooleanPropertyDescriber.php @@ -14,7 +14,7 @@ use OpenApi\Annotations as OA; use Symfony\Component\PropertyInfo\Type; -class BooleanPropertyDescriber implements PropertyDescriberInterface +final class BooleanPropertyDescriber implements PropertyDescriberInterface { /** * @param array $context Context options for describing the property diff --git a/src/PropertyDescriber/CompoundPropertyDescriber.php b/src/PropertyDescriber/CompoundPropertyDescriber.php index 8cf5c4b54..1457f95bc 100644 --- a/src/PropertyDescriber/CompoundPropertyDescriber.php +++ b/src/PropertyDescriber/CompoundPropertyDescriber.php @@ -17,7 +17,7 @@ use OpenApi\Annotations as OA; use OpenApi\Generator; -class CompoundPropertyDescriber implements PropertyDescriberInterface, ModelRegistryAwareInterface, PropertyDescriberAwareInterface +final class CompoundPropertyDescriber implements PropertyDescriberInterface, ModelRegistryAwareInterface, PropertyDescriberAwareInterface { use ModelRegistryAwareTrait; use PropertyDescriberAwareTrait; diff --git a/src/PropertyDescriber/DateTimePropertyDescriber.php b/src/PropertyDescriber/DateTimePropertyDescriber.php index 50ade7408..d50ae84dd 100644 --- a/src/PropertyDescriber/DateTimePropertyDescriber.php +++ b/src/PropertyDescriber/DateTimePropertyDescriber.php @@ -14,7 +14,7 @@ use OpenApi\Annotations as OA; use Symfony\Component\PropertyInfo\Type; -class DateTimePropertyDescriber implements PropertyDescriberInterface +final class DateTimePropertyDescriber implements PropertyDescriberInterface { /** * @param array $context Context options for describing the property diff --git a/src/PropertyDescriber/FloatPropertyDescriber.php b/src/PropertyDescriber/FloatPropertyDescriber.php index 7dc29cf1d..0ce1fbf39 100644 --- a/src/PropertyDescriber/FloatPropertyDescriber.php +++ b/src/PropertyDescriber/FloatPropertyDescriber.php @@ -14,7 +14,7 @@ use OpenApi\Annotations as OA; use Symfony\Component\PropertyInfo\Type; -class FloatPropertyDescriber implements PropertyDescriberInterface +final class FloatPropertyDescriber implements PropertyDescriberInterface { /** * @param array $context Context options for describing the property diff --git a/src/PropertyDescriber/IntegerPropertyDescriber.php b/src/PropertyDescriber/IntegerPropertyDescriber.php index 4d20443b9..1a57482d8 100644 --- a/src/PropertyDescriber/IntegerPropertyDescriber.php +++ b/src/PropertyDescriber/IntegerPropertyDescriber.php @@ -14,7 +14,7 @@ use OpenApi\Annotations as OA; use Symfony\Component\PropertyInfo\Type; -class IntegerPropertyDescriber implements PropertyDescriberInterface +final class IntegerPropertyDescriber implements PropertyDescriberInterface { /** * @param array $context Context options for describing the property diff --git a/src/PropertyDescriber/ObjectPropertyDescriber.php b/src/PropertyDescriber/ObjectPropertyDescriber.php index 2b2084415..1c3a3ad8b 100644 --- a/src/PropertyDescriber/ObjectPropertyDescriber.php +++ b/src/PropertyDescriber/ObjectPropertyDescriber.php @@ -18,7 +18,7 @@ use OpenApi\Annotations as OA; use Symfony\Component\PropertyInfo\Type; -class ObjectPropertyDescriber implements PropertyDescriberInterface, ModelRegistryAwareInterface +final class ObjectPropertyDescriber implements PropertyDescriberInterface, ModelRegistryAwareInterface { use ModelRegistryAwareTrait; diff --git a/src/PropertyDescriber/StringPropertyDescriber.php b/src/PropertyDescriber/StringPropertyDescriber.php index 73841efff..0ac285392 100644 --- a/src/PropertyDescriber/StringPropertyDescriber.php +++ b/src/PropertyDescriber/StringPropertyDescriber.php @@ -14,7 +14,7 @@ use OpenApi\Annotations as OA; use Symfony\Component\PropertyInfo\Type; -class StringPropertyDescriber implements PropertyDescriberInterface +final class StringPropertyDescriber implements PropertyDescriberInterface { /** * @param array $context Context options for describing the property