diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 980635cd9..a65465199 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -10,11 +10,6 @@ parameters: count: 2 path: src/Render/Html/HtmlOpenApiRenderer.php - - - message: "#^Class Twig_Environment not found\\.$#" - count: 1 - path: src/Render/Html/HtmlOpenApiRenderer.php - - message: "#^Parameter \\$twig of method Nelmio\\\\ApiDocBundle\\\\Render\\\\Html\\\\HtmlOpenApiRenderer\\:\\:__construct\\(\\) has invalid type Twig_Environment\\.$#" count: 1 diff --git a/src/ApiDocGenerator.php b/src/ApiDocGenerator.php index e22c36106..4ed99a4d4 100644 --- a/src/ApiDocGenerator.php +++ b/src/ApiDocGenerator.php @@ -30,14 +30,6 @@ final class ApiDocGenerator /** @var OpenApi */ private $openApi; - /** @var iterable|DescriberInterface[] */ - private $describers; - - /** @var iterable|ModelDescriberInterface[] */ - private $modelDescribers; - - private ?CacheItemPoolInterface $cacheItemPool; - private string $cacheItemId; /** @var string[] */ @@ -53,14 +45,16 @@ final class ApiDocGenerator private Generator $generator; /** - * @param DescriberInterface[]|iterable $describers - * @param ModelDescriberInterface[]|iterable $modelDescribers + * @param iterable $describers + * @param iterable $modelDescribers */ - public function __construct($describers, $modelDescribers, ?CacheItemPoolInterface $cacheItemPool = null, ?string $cacheItemId = null, ?Generator $generator = null) - { - $this->describers = $describers; - $this->modelDescribers = $modelDescribers; - $this->cacheItemPool = $cacheItemPool; + public function __construct( + private iterable $describers, + private iterable $modelDescribers, + private ?CacheItemPoolInterface $cacheItemPool = null, + ?string $cacheItemId = null, + ?Generator $generator = null, + ) { $this->cacheItemId = $cacheItemId ?? 'openapi_doc'; $this->generator = $generator ?? new Generator($this->logger); } diff --git a/src/Attribute/Model.php b/src/Attribute/Model.php index 677797e8f..09b85ad6c 100644 --- a/src/Attribute/Model.php +++ b/src/Attribute/Model.php @@ -30,23 +30,6 @@ final class Model extends Attachable Parameter::class, ]; - public string $type; - - /** - * @var string[]|null - */ - public ?array $groups; - - /** - * @var mixed[] - */ - public array $options; - - /** - * @var array - */ - public array $serializationContext; - /** * @param mixed[] $properties * @param string[] $groups @@ -55,10 +38,10 @@ final class Model extends Attachable */ public function __construct( array $properties = [], - string $type = Generator::UNDEFINED, - ?array $groups = null, - array $options = [], - array $serializationContext = [], + public string $type = Generator::UNDEFINED, + public ?array $groups = null, + public array $options = [], + public array $serializationContext = [], ) { parent::__construct($properties + [ 'type' => $type, diff --git a/src/Attribute/Security.php b/src/Attribute/Security.php index fe3c92d19..55b4b7903 100644 --- a/src/Attribute/Security.php +++ b/src/Attribute/Security.php @@ -23,21 +23,14 @@ class Security extends AbstractAnnotation public static $_required = ['name']; - public ?string $name; - - /** - * @var string[] - */ - public array $scopes = []; - /** * @param array $properties * @param string[] $scopes */ public function __construct( array $properties = [], - ?string $name = null, - array $scopes = [], + public ?string $name = null, + public array $scopes = [], ) { parent::__construct($properties + [ 'name' => $name, diff --git a/src/Command/DumpCommand.php b/src/Command/DumpCommand.php index 332cc01d0..c2a8a41dc 100644 --- a/src/Command/DumpCommand.php +++ b/src/Command/DumpCommand.php @@ -20,21 +20,18 @@ final class DumpCommand extends Command { - private RenderOpenApi $renderOpenApi; - /** * @var mixed[] */ - private $defaultHtmlConfig = [ + private array $defaultHtmlConfig = [ 'assets_mode' => AssetsMode::CDN, 'swagger_ui_config' => [], 'redocly_config' => [], ]; - public function __construct(RenderOpenApi $renderOpenApi) - { - $this->renderOpenApi = $renderOpenApi; - + public function __construct( + private RenderOpenApi $renderOpenApi, + ) { parent::__construct(); } diff --git a/src/Controller/DocumentationController.php b/src/Controller/DocumentationController.php index cc3ab34e2..d5a66e6db 100644 --- a/src/Controller/DocumentationController.php +++ b/src/Controller/DocumentationController.php @@ -19,11 +19,9 @@ final class DocumentationController { - private RenderOpenApi $renderOpenApi; - - public function __construct(RenderOpenApi $renderOpenApi) - { - $this->renderOpenApi = $renderOpenApi; + public function __construct( + private RenderOpenApi $renderOpenApi, + ) { } public function __invoke(Request $request, string $area = 'default'): JsonResponse diff --git a/src/Controller/SwaggerUiController.php b/src/Controller/SwaggerUiController.php index d79d34f74..7344b73f1 100644 --- a/src/Controller/SwaggerUiController.php +++ b/src/Controller/SwaggerUiController.php @@ -19,14 +19,10 @@ final class SwaggerUiController { - private RenderOpenApi $renderOpenApi; - - private string $uiRenderer; - - public function __construct(RenderOpenApi $renderOpenApi, string $uiRenderer) - { - $this->renderOpenApi = $renderOpenApi; - $this->uiRenderer = $uiRenderer; + public function __construct( + private RenderOpenApi $renderOpenApi, + private string $uiRenderer, + ) { } public function __invoke(Request $request, string $area = 'default'): Response diff --git a/src/Controller/YamlDocumentationController.php b/src/Controller/YamlDocumentationController.php index 0cd65f8d4..fb69125b9 100644 --- a/src/Controller/YamlDocumentationController.php +++ b/src/Controller/YamlDocumentationController.php @@ -18,11 +18,9 @@ final class YamlDocumentationController { - private RenderOpenApi $renderOpenApi; - - public function __construct(RenderOpenApi $renderOpenApi) - { - $this->renderOpenApi = $renderOpenApi; + public function __construct( + private RenderOpenApi $renderOpenApi, + ) { } public function __invoke(Request $request, string $area = 'default'): Response diff --git a/src/Describer/ExternalDocDescriber.php b/src/Describer/ExternalDocDescriber.php index 1a17093f1..49672c994 100644 --- a/src/Describer/ExternalDocDescriber.php +++ b/src/Describer/ExternalDocDescriber.php @@ -16,20 +16,13 @@ class ExternalDocDescriber implements DescriberInterface { - /** - * @var array|callable - */ - private $externalDoc; - - private bool $overwrite; - /** * @param array|callable $externalDoc */ - public function __construct($externalDoc, bool $overwrite = false) - { - $this->externalDoc = $externalDoc; - $this->overwrite = $overwrite; + public function __construct( + private $externalDoc, + private bool $overwrite = false, + ) { } public function describe(OA\OpenApi $api): void diff --git a/src/Describer/OpenApiPhpDescriber.php b/src/Describer/OpenApiPhpDescriber.php index 67ca6c5cd..68380fcb7 100644 --- a/src/Describer/OpenApiPhpDescriber.php +++ b/src/Describer/OpenApiPhpDescriber.php @@ -30,15 +30,11 @@ final class OpenApiPhpDescriber { use SetsContextTrait; - private RouteCollection $routeCollection; - private ControllerReflector $controllerReflector; - private LoggerInterface $logger; - - public function __construct(RouteCollection $routeCollection, ControllerReflector $controllerReflector, LoggerInterface $logger) - { - $this->routeCollection = $routeCollection; - $this->controllerReflector = $controllerReflector; - $this->logger = $logger; + public function __construct( + private RouteCollection $routeCollection, + private ControllerReflector $controllerReflector, + private LoggerInterface $logger, + ) { } public function describe(OA\OpenApi $api): void diff --git a/src/Describer/RouteDescriber.php b/src/Describer/RouteDescriber.php index 41022e4e2..c8a2532af 100644 --- a/src/Describer/RouteDescriber.php +++ b/src/Describer/RouteDescriber.php @@ -20,23 +20,14 @@ final class RouteDescriber implements DescriberInterface, ModelRegistryAwareInte { use ModelRegistryAwareTrait; - private RouteCollection $routeCollection; - - private ControllerReflector $controllerReflector; - - /** - * @var iterable - */ - private iterable $routeDescribers; - /** - * @param RouteDescriberInterface[]|iterable $routeDescribers + * @param iterable $routeDescribers */ - public function __construct(RouteCollection $routeCollection, ControllerReflector $controllerReflector, $routeDescribers) - { - $this->routeCollection = $routeCollection; - $this->controllerReflector = $controllerReflector; - $this->routeDescribers = $routeDescribers; + public function __construct( + private RouteCollection $routeCollection, + private ControllerReflector $controllerReflector, + private iterable $routeDescribers, + ) { } public function describe(OA\OpenApi $api): void diff --git a/src/Model/Model.php b/src/Model/Model.php index 304bdf672..8f09ba747 100644 --- a/src/Model/Model.php +++ b/src/Model/Model.php @@ -15,28 +15,17 @@ final class Model { - private Type $type; - - /** - * @var mixed[] - */ - private array $options; - - /** - * @var mixed[] - */ - private array $serializationContext; - /** * @param string[]|null $groups * @param mixed[] $options * @param mixed[] $serializationContext */ - public function __construct(Type $type, ?array $groups = null, array $options = [], array $serializationContext = []) + public function __construct( + private Type $type, + ?array $groups = null, + private array $options = [], + private array $serializationContext = []) { - $this->type = $type; - $this->options = $options; - $this->serializationContext = $serializationContext; if (null !== $groups) { $this->serializationContext['groups'] = $groups; } diff --git a/src/Model/ModelRegistry.php b/src/Model/ModelRegistry.php index 00efab40a..4b4d86d2c 100644 --- a/src/Model/ModelRegistry.php +++ b/src/Model/ModelRegistry.php @@ -49,22 +49,16 @@ final class ModelRegistry private array $names = []; /** - * @var iterable - */ - private iterable $modelDescribers; - - private OA\OpenApi $api; - - /** - * @param ModelDescriberInterface[]|iterable $modelDescribers - * @param array $alternativeNames + * @param iterable $modelDescribers + * @param array $alternativeNames * * @internal */ - public function __construct($modelDescribers, OA\OpenApi $api, array $alternativeNames = []) + public function __construct( + private iterable $modelDescribers, + private OA\OpenApi $api, + array $alternativeNames = []) { - $this->modelDescribers = $modelDescribers; - $this->api = $api; $this->logger = new NullLogger(); foreach (array_reverse($alternativeNames) as $alternativeName => $criteria) { $this->alternativeNames[] = $model = new Model( diff --git a/src/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php b/src/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php index 8696a63a4..a6d79a5c6 100644 --- a/src/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php +++ b/src/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php @@ -26,16 +26,11 @@ class SymfonyConstraintAnnotationReader { use SetsContextTrait; - /** - * @var OA\Schema - */ - private $schema; + private OA\Schema $schema; - private bool $useValidationGroups; - - public function __construct(bool $useValidationGroups = false) - { - $this->useValidationGroups = $useValidationGroups; + public function __construct( + private bool $useValidationGroups = false, + ) { } /** @@ -68,11 +63,6 @@ private function processPropertyAttributes($reflection, OA\Property $property, a return; } - // The field is required - if (null === $this->schema) { - return; - } - $propertyName = Util::getSchemaPropertyName($this->schema, $property); if (null === $propertyName) { return; diff --git a/src/ModelDescriber/BazingaHateoasModelDescriber.php b/src/ModelDescriber/BazingaHateoasModelDescriber.php index 117fe719d..1066c322a 100644 --- a/src/ModelDescriber/BazingaHateoasModelDescriber.php +++ b/src/ModelDescriber/BazingaHateoasModelDescriber.php @@ -26,13 +26,10 @@ class BazingaHateoasModelDescriber implements ModelDescriberInterface, ModelRegi { use ModelRegistryAwareTrait; - private MetadataFactoryInterface $factory; - private JMSModelDescriber $JMSModelDescriber; - - public function __construct(MetadataFactoryInterface $factory, JMSModelDescriber $JMSModelDescriber) - { - $this->factory = $factory; - $this->JMSModelDescriber = $JMSModelDescriber; + public function __construct( + private MetadataFactoryInterface $factory, + private JMSModelDescriber $JMSModelDescriber, + ) { } public function setModelRegistry(ModelRegistry $modelRegistry): void diff --git a/src/ModelDescriber/FormModelDescriber.php b/src/ModelDescriber/FormModelDescriber.php index cf89bc9e1..e20a271e9 100644 --- a/src/ModelDescriber/FormModelDescriber.php +++ b/src/ModelDescriber/FormModelDescriber.php @@ -37,28 +37,15 @@ final class FormModelDescriber implements ModelDescriberInterface, ModelRegistry use ModelRegistryAwareTrait; use SetsContextTrait; - private FormFactoryInterface $formFactory; - - /** - * @var string[] - */ - private array $mediaTypes; - private bool $useValidationGroups; - private bool $isFormCsrfExtensionEnabled; - /** * @param string[] $mediaTypes */ public function __construct( - FormFactoryInterface $formFactory, - array $mediaTypes, - bool $useValidationGroups, - bool $isFormCsrfExtensionEnabled, + private FormFactoryInterface $formFactory, + private array $mediaTypes, + private bool $useValidationGroups, + private bool $isFormCsrfExtensionEnabled, ) { - $this->formFactory = $formFactory; - $this->mediaTypes = $mediaTypes; - $this->useValidationGroups = $useValidationGroups; - $this->isFormCsrfExtensionEnabled = $isFormCsrfExtensionEnabled; } public function describe(Model $model, OA\Schema $schema): void diff --git a/src/ModelDescriber/JMSModelDescriber.php b/src/ModelDescriber/JMSModelDescriber.php index 81d376a60..633dac767 100644 --- a/src/ModelDescriber/JMSModelDescriber.php +++ b/src/ModelDescriber/JMSModelDescriber.php @@ -35,12 +35,6 @@ class JMSModelDescriber implements ModelDescriberInterface, ModelRegistryAwareIn use ApplyOpenApiDiscriminatorTrait; use ModelRegistryAwareTrait; - private MetadataFactoryInterface $factory; - - private ?SerializationContextFactoryInterface $contextFactory; - - private ?PropertyNamingStrategyInterface $namingStrategy; - /** * @var array */ @@ -51,33 +45,21 @@ class JMSModelDescriber implements ModelDescriberInterface, ModelRegistryAwareIn */ private array $metadataStacks = []; - /** - * @var string[] - */ - private array $mediaTypes; - /** * @var array */ private array $propertyTypeUseGroupsCache = []; - private bool $useValidationGroups; - /** * @param string[] $mediaTypes */ public function __construct( - MetadataFactoryInterface $factory, - array $mediaTypes, - ?PropertyNamingStrategyInterface $namingStrategy = null, - bool $useValidationGroups = false, - ?SerializationContextFactoryInterface $contextFactory = null, + private MetadataFactoryInterface $factory, + private array $mediaTypes, + private ?PropertyNamingStrategyInterface $namingStrategy = null, + private bool $useValidationGroups = false, + private ?SerializationContextFactoryInterface $contextFactory = null, ) { - $this->factory = $factory; - $this->namingStrategy = $namingStrategy; - $this->mediaTypes = $mediaTypes; - $this->useValidationGroups = $useValidationGroups; - $this->contextFactory = $contextFactory; } public function describe(Model $model, OA\Schema $schema): void diff --git a/src/ModelDescriber/ObjectModelDescriber.php b/src/ModelDescriber/ObjectModelDescriber.php index 7e32dd8fb..d8be6cfbd 100644 --- a/src/ModelDescriber/ObjectModelDescriber.php +++ b/src/ModelDescriber/ObjectModelDescriber.php @@ -30,33 +30,18 @@ class ObjectModelDescriber implements ModelDescriberInterface, ModelRegistryAwar use ApplyOpenApiDiscriminatorTrait; use ModelRegistryAwareTrait; - private PropertyInfoExtractorInterface $propertyInfo; - private ?ClassMetadataFactoryInterface $classMetadataFactory; - private PropertyDescriberInterface $propertyDescriber; - /** @var string[] */ - private array $mediaTypes; - /** @var (NameConverterInterface&AdvancedNameConverterInterface)|null */ - private ?NameConverterInterface $nameConverter; - private bool $useValidationGroups; - /** * @param (NameConverterInterface&AdvancedNameConverterInterface)|null $nameConverter * @param string[] $mediaTypes */ public function __construct( - PropertyInfoExtractorInterface $propertyInfo, - PropertyDescriberInterface $propertyDescribers, - array $mediaTypes, - ?NameConverterInterface $nameConverter = null, - bool $useValidationGroups = false, - ?ClassMetadataFactoryInterface $classMetadataFactory = null, + private PropertyInfoExtractorInterface $propertyInfo, + private PropertyDescriberInterface $propertyDescriber, + private array $mediaTypes, + private ?NameConverterInterface $nameConverter = null, + private bool $useValidationGroups = false, + private ?ClassMetadataFactoryInterface $classMetadataFactory = null, ) { - $this->propertyInfo = $propertyInfo; - $this->propertyDescriber = $propertyDescribers; - $this->mediaTypes = $mediaTypes; - $this->nameConverter = $nameConverter; - $this->useValidationGroups = $useValidationGroups; - $this->classMetadataFactory = $classMetadataFactory; } public function describe(Model $model, OA\Schema $schema): void diff --git a/src/OpenApiPhp/ModelRegister.php b/src/OpenApiPhp/ModelRegister.php index fb2776d01..96a186475 100644 --- a/src/OpenApiPhp/ModelRegister.php +++ b/src/OpenApiPhp/ModelRegister.php @@ -26,18 +26,13 @@ */ final class ModelRegister { - private ModelRegistry $modelRegistry; - - /** @var string[] */ - private array $mediaTypes; - /** * @param string[] $mediaTypes */ - public function __construct(ModelRegistry $modelRegistry, array $mediaTypes) - { - $this->modelRegistry = $modelRegistry; - $this->mediaTypes = $mediaTypes; + public function __construct( + private ModelRegistry $modelRegistry, + private array $mediaTypes, + ) { } /** diff --git a/src/PropertyDescriber/PropertyDescriber.php b/src/PropertyDescriber/PropertyDescriber.php index 03793ae1b..15a1953f7 100644 --- a/src/PropertyDescriber/PropertyDescriber.php +++ b/src/PropertyDescriber/PropertyDescriber.php @@ -25,16 +25,12 @@ final class PropertyDescriber implements PropertyDescriberInterface, ModelRegist /** @var array Recursion helper */ private array $called = []; - /** @var iterable */ - private iterable $propertyDescribers; - /** * @param iterable $propertyDescribers */ public function __construct( - iterable $propertyDescribers, + private iterable $propertyDescribers, ) { - $this->propertyDescribers = $propertyDescribers; } /** diff --git a/src/Render/Html/GetNelmioAsset.php b/src/Render/Html/GetNelmioAsset.php index 821ba04a5..0438e389d 100644 --- a/src/Render/Html/GetNelmioAsset.php +++ b/src/Render/Html/GetNelmioAsset.php @@ -20,13 +20,12 @@ */ class GetNelmioAsset extends AbstractExtension { - private AssetExtension $assetExtension; private string $resourcesDir; private string $cdnUrl; - public function __construct(AssetExtension $assetExtension) + public function __construct( + private AssetExtension $assetExtension) { - $this->assetExtension = $assetExtension; $this->cdnUrl = 'https://cdn.jsdelivr.net/gh/nelmio/NelmioApiDocBundle/public'; $this->resourcesDir = __DIR__.'/../../../public'; } diff --git a/src/Render/Html/HtmlOpenApiRenderer.php b/src/Render/Html/HtmlOpenApiRenderer.php index bb6a3f42a..4199d4ae0 100644 --- a/src/Render/Html/HtmlOpenApiRenderer.php +++ b/src/Render/Html/HtmlOpenApiRenderer.php @@ -21,22 +21,13 @@ */ class HtmlOpenApiRenderer implements OpenApiRenderer { - /** @var Environment|\Twig_Environment */ - private $twig; - /** @var array */ - private array $htmlConfig; - /** - * @param Environment|\Twig_Environment $twig - * @param array $htmlConfig + * @param array $htmlConfig */ - public function __construct($twig, array $htmlConfig) - { - if (!$twig instanceof \Twig_Environment && !$twig instanceof Environment) { - throw new \InvalidArgumentException(\sprintf('Providing an instance of "%s" as twig is not supported.', $twig::class)); - } - $this->twig = $twig; - $this->htmlConfig = $htmlConfig; + public function __construct( + private Environment|\Twig_Environment $twig, + private array $htmlConfig, + ) { } public function getFormat(): string diff --git a/src/Render/RenderOpenApi.php b/src/Render/RenderOpenApi.php index 6a32a1309..ff7ffc8a9 100644 --- a/src/Render/RenderOpenApi.php +++ b/src/Render/RenderOpenApi.php @@ -25,14 +25,13 @@ class RenderOpenApi public const JSON = 'json'; public const YAML = 'yaml'; - private ContainerInterface $generatorLocator; - /** @var array */ private array $openApiRenderers = []; - public function __construct(ContainerInterface $generatorLocator, ?OpenApiRenderer ...$openApiRenderers) - { - $this->generatorLocator = $generatorLocator; + public function __construct( + private ContainerInterface $generatorLocator, + ?OpenApiRenderer ...$openApiRenderers, + ) { foreach ($openApiRenderers as $openApiRenderer) { if (null === $openApiRenderer) { continue; diff --git a/src/RouteDescriber/FosRestDescriber.php b/src/RouteDescriber/FosRestDescriber.php index b8ccb244a..c88e7ee87 100644 --- a/src/RouteDescriber/FosRestDescriber.php +++ b/src/RouteDescriber/FosRestDescriber.php @@ -27,15 +27,12 @@ final class FosRestDescriber implements RouteDescriberInterface { use RouteDescriberTrait; - /** @var string[] */ - private array $mediaTypes; - /** * @param string[] $mediaTypes */ - public function __construct(array $mediaTypes) + public function __construct( + private array $mediaTypes) { - $this->mediaTypes = $mediaTypes; } public function describe(OA\OpenApi $api, Route $route, \ReflectionMethod $reflectionMethod): void diff --git a/src/Routing/FilteredRouteCollectionBuilder.php b/src/Routing/FilteredRouteCollectionBuilder.php index 88bf0eff4..51c028f13 100644 --- a/src/Routing/FilteredRouteCollectionBuilder.php +++ b/src/Routing/FilteredRouteCollectionBuilder.php @@ -20,10 +20,6 @@ final class FilteredRouteCollectionBuilder { - private ControllerReflector $controllerReflector; - - private string $area; - /** * @var array */ @@ -33,8 +29,8 @@ final class FilteredRouteCollectionBuilder * @param array $options */ public function __construct( - ControllerReflector $controllerReflector, - string $area, + private ControllerReflector $controllerReflector, + private string $area, array $options = [], ) { $resolver = new OptionsResolver(); @@ -53,8 +49,6 @@ public function __construct( ->setAllowedTypes('disable_default_routes', 'boolean') ; - $this->controllerReflector = $controllerReflector; - $this->area = $area; $this->options = $resolver->resolve($options); } diff --git a/src/Util/ControllerReflector.php b/src/Util/ControllerReflector.php index 43ad14458..e83fd6271 100644 --- a/src/Util/ControllerReflector.php +++ b/src/Util/ControllerReflector.php @@ -18,15 +18,14 @@ */ class ControllerReflector { - private ContainerInterface $container; /** * @var array */ private array $controllers = []; - public function __construct(ContainerInterface $container) - { - $this->container = $container; + public function __construct( + private ContainerInterface $container, + ) { } /** diff --git a/tests/Functional/ModelDescriber/NameConverter.php b/tests/Functional/ModelDescriber/NameConverter.php index cb42c59f3..a8dd73a2b 100644 --- a/tests/Functional/ModelDescriber/NameConverter.php +++ b/tests/Functional/ModelDescriber/NameConverter.php @@ -18,11 +18,9 @@ class NameConverter implements AdvancedNameConverterInterface { - private MetadataAwareNameConverter $inner; - - public function __construct(MetadataAwareNameConverter $inner) - { - $this->inner = $inner; + public function __construct( + private MetadataAwareNameConverter $inner, + ) { } /** diff --git a/tests/Functional/NelmioKernel.php b/tests/Functional/NelmioKernel.php index 7adf3895f..296fbe0da 100644 --- a/tests/Functional/NelmioKernel.php +++ b/tests/Functional/NelmioKernel.php @@ -25,31 +25,16 @@ final class NelmioKernel extends Kernel use MicroKernelTrait; /** - * @var Bundle[] + * @param Bundle[] $extraBundles + * @param callable|null $routeConfiguration + * @param string[] $extraConfigs */ - private array $extraBundles; - - /** - * @var callable|null - */ - private $routeConfiguration; - - /** - * @var string[] - */ - private array $extraConfigs; - - /** - * @param Bundle[] $extraBundles - * @param string[] $extraConfigs - */ - public function __construct(array $extraBundles, ?callable $routeConfiguration, array $extraConfigs) - { + public function __construct( + private array $extraBundles, + private $routeConfiguration, + private array $extraConfigs, + ) { parent::__construct('test', true); - - $this->extraBundles = $extraBundles; - $this->routeConfiguration = $routeConfiguration; - $this->extraConfigs = $extraConfigs; } public function registerBundles(): iterable diff --git a/tests/Functional/TestKernel.php b/tests/Functional/TestKernel.php index cd9201f2d..25d318162 100644 --- a/tests/Functional/TestKernel.php +++ b/tests/Functional/TestKernel.php @@ -45,13 +45,10 @@ class TestKernel extends Kernel public const USE_VALIDATION_GROUPS = 8; public const USE_FORM_CSRF = 16; - private int $flag; - - public function __construct(int $flag = 0) - { + public function __construct( + private int $flag = 0, + ) { parent::__construct('test'.$flag, true); - - $this->flag = $flag; } public function registerBundles(): iterable