diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml
index 5500844..fb2871f 100644
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -24,18 +24,16 @@ jobs:
strategy:
matrix:
include:
- - php-version: 7.1
- composer-flags: "--prefer-lowest"
- php-version: 7.2
- symfony-require: "^4.0"
+ composer-flags: "--prefer-lowest"
- php-version: 7.3
- symfony-require: "^5.0"
+ symfony-require: "4.4.*"
- php-version: 7.4
- symfony-require: "^4.0"
- - php-version: 7.3
- symfony-require: "^5.0"
+ symfony-require: "5.3.*"
- php-version: 8.0
- composer-flags: "--ignore-platform-reqs"
+ symfony-require: "5.4.*"
+ - php-version: 8.1
+ symfony-require: "5.4.*"
steps:
- name: "Checkout"
diff --git a/ApiDocGenerator.php b/ApiDocGenerator.php
index 57b1059..161e104 100644
--- a/ApiDocGenerator.php
+++ b/ApiDocGenerator.php
@@ -20,6 +20,7 @@ use Nelmio\ApiDocBundle\OpenApiPhp\ModelRegister;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use OpenApi\Analysis;
use OpenApi\Annotations\OpenApi;
+use OpenApi\Generator;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Log\LoggerAwareTrait;
@@ -110,7 +111,7 @@ final class ApiDocGenerator
$defaultOperationIdProcessor = new DefaultOperationId();
$defaultOperationIdProcessor($analysis);
- $analysis->process();
+ $analysis->process((new Generator())->getProcessors());
$analysis->validate();
if (isset($item)) {
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 18879d6..7c469cd 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -16,7 +16,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
final class Configuration implements ConfigurationInterface
{
- public function getConfigTreeBuilder()
+ public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('nelmio_api_doc');
diff --git a/DependencyInjection/NelmioApiDocExtension.php b/DependencyInjection/NelmioApiDocExtension.php
index 1a40a42..caf2cc2 100644
--- a/DependencyInjection/NelmioApiDocExtension.php
+++ b/DependencyInjection/NelmioApiDocExtension.php
@@ -153,14 +153,15 @@ final class NelmioApiDocExtension extends Extension implements PrependExtensionI
->setArgument(1, $config['media_types']);
}
- // ApiPlatform support
$bundles = $container->getParameter('kernel.bundles');
- if (!isset($bundles['TwigBundle'])) {
+ if (!isset($bundles['TwigBundle']) || !class_exists('Symfony\Component\Asset\Packages')) {
$container->removeDefinition('nelmio_api_doc.controller.swagger_ui');
$container->removeDefinition('nelmio_api_doc.render_docs.html');
$container->removeDefinition('nelmio_api_doc.render_docs.html.asset');
}
+
+ // ApiPlatform support
if (isset($bundles['ApiPlatformBundle']) && class_exists('ApiPlatform\Core\Documentation\Documentation')) {
$loader->load('api_platform.xml');
}
diff --git a/Describer/DefaultDescriber.php b/Describer/DefaultDescriber.php
index 5217d3c..3812e3a 100644
--- a/Describer/DefaultDescriber.php
+++ b/Describer/DefaultDescriber.php
@@ -13,6 +13,7 @@ namespace Nelmio\ApiDocBundle\Describer;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use OpenApi\Annotations as OA;
+use OpenApi\Generator;
/**
* Makes the swagger documentation valid even if there are missing fields.
@@ -26,22 +27,22 @@ final class DefaultDescriber implements DescriberInterface
// Info
/** @var OA\Info $info */
$info = Util::getChild($api, OA\Info::class);
- if (OA\UNDEFINED === $info->title) {
+ if (Generator::UNDEFINED === $info->title) {
$info->title = '';
}
- if (OA\UNDEFINED === $info->version) {
+ if (Generator::UNDEFINED === $info->version) {
$info->version = '0.0.0';
}
// Paths
- if (OA\UNDEFINED === $api->paths) {
+ if (Generator::UNDEFINED === $api->paths) {
$api->paths = [];
}
foreach ($api->paths as $path) {
foreach (Util::OPERATIONS as $method) {
/** @var OA\Operation $operation */
$operation = $path->{$method};
- if (OA\UNDEFINED !== $operation && null !== $operation && (OA\UNDEFINED === $operation->responses || empty($operation->responses))) {
+ if (Generator::UNDEFINED !== $operation && null !== $operation && (Generator::UNDEFINED === $operation->responses || empty($operation->responses))) {
/** @var OA\Response $response */
$response = Util::getIndexedCollectionItem($operation, OA\Response::class, 'default');
$response->description = '';
diff --git a/Describer/OpenApiPhpDescriber.php b/Describer/OpenApiPhpDescriber.php
index 4f03918..3c3e485 100644
--- a/Describer/OpenApiPhpDescriber.php
+++ b/Describer/OpenApiPhpDescriber.php
@@ -16,8 +16,9 @@ use Nelmio\ApiDocBundle\Annotation\Operation;
use Nelmio\ApiDocBundle\Annotation\Security;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use Nelmio\ApiDocBundle\Util\ControllerReflector;
-use OpenApi\Analyser;
+use Nelmio\ApiDocBundle\Util\SetsContextTrait;
use OpenApi\Annotations as OA;
+use OpenApi\Generator;
use Psr\Log\LoggerInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
@@ -27,6 +28,8 @@ class_exists(OA\OpenApi::class);
final class OpenApiPhpDescriber
{
+ use SetsContextTrait;
+
private $routeCollection;
private $controllerReflector;
private $annotationReader;
@@ -47,16 +50,18 @@ final class OpenApiPhpDescriber
$classAnnotations = [];
/** @var \ReflectionMethod $method */
- foreach ($this->getMethodsToParse() as $method => list($path, $httpMethods)) {
+ foreach ($this->getMethodsToParse() as $method => list($path, $httpMethods, $routeName)) {
$declaringClass = $method->getDeclaringClass();
$path = Util::getPath($api, $path);
- Analyser::$context = Util::createContext(['nested' => $path], $path->_context);
- Analyser::$context->namespace = $method->getNamespaceName();
- Analyser::$context->class = $declaringClass->getShortName();
- Analyser::$context->method = $method->name;
- Analyser::$context->filename = $method->getFileName();
+ $context = Util::createContext(['nested' => $path], $path->_context);
+ $context->namespace = $method->getNamespaceName();
+ $context->class = $declaringClass->getShortName();
+ $context->method = $method->name;
+ $context->filename = $method->getFileName();
+
+ $this->setContext($context);
if (!array_key_exists($declaringClass->getName(), $classAnnotations)) {
$classAnnotations = array_filter($this->annotationReader->getClassAnnotations($declaringClass), function ($v) {
@@ -90,7 +95,7 @@ final class OpenApiPhpDescriber
if (!in_array($annotation->method, $httpMethods, true)) {
continue;
}
- if (OA\UNDEFINED !== $annotation->path && $path->path !== $annotation->path) {
+ if (Generator::UNDEFINED !== $annotation->path && $path->path !== $annotation->path) {
continue;
}
@@ -134,16 +139,20 @@ final class OpenApiPhpDescriber
$operation = Util::getOperation($path, $httpMethod);
$operation->merge($implicitAnnotations);
$operation->mergeProperties($mergeProperties);
+
+ if (Generator::UNDEFINED === $operation->operationId) {
+ $operation->operationId = $httpMethod.'_'.$routeName;
+ }
}
}
- // Reset the Analyser after the parsing
- Analyser::$context = null;
+ // Reset the Generator after the parsing
+ $this->setContext(null);
}
private function getMethodsToParse(): \Generator
{
- foreach ($this->routeCollection->all() as $route) {
+ foreach ($this->routeCollection->all() as $routeName => $route) {
if (!$route->hasDefault('_controller')) {
continue;
}
@@ -161,7 +170,7 @@ final class OpenApiPhpDescriber
continue;
}
- yield $reflectedMethod => [$path, $supportedHttpMethods];
+ yield $reflectedMethod => [$path, $supportedHttpMethods, $routeName];
}
}
diff --git a/Model/ModelRegistry.php b/Model/ModelRegistry.php
index 8926264..db346fb 100644
--- a/Model/ModelRegistry.php
+++ b/Model/ModelRegistry.php
@@ -144,8 +144,8 @@ final class ModelRegistry
'built_in_type' => $type->getBuiltinType(),
'nullable' => $type->isNullable(),
'collection' => $type->isCollection(),
- 'collection_key_types' => $type->isCollection() ? array_map($getType, $type->getCollectionKeyTypes()) : null,
- 'collection_value_types' => $type->isCollection() ? array_map($getType, $type->getCollectionValueTypes()) : null,
+ 'collection_key_types' => $type->isCollection() ? array_map($getType, $this->getCollectionKeyTypes($type)) : null,
+ 'collection_value_types' => $type->isCollection() ? array_map($getType, $this->getCollectionValueTypes($type)) : null,
];
};
@@ -186,6 +186,26 @@ final class ModelRegistry
}
}
+ private function getCollectionKeyTypes(Type $type): array
+ {
+ // BC layer, this condition should be removed after removing support for symfony < 5.3
+ if (!method_exists($type, 'getCollectionKeyTypes')) {
+ return null !== $type->getCollectionKeyType() ? [$type->getCollectionKeyType()] : [];
+ }
+
+ return $type->getCollectionKeyTypes();
+ }
+
+ private function getCollectionValueTypes(Type $type): array
+ {
+ // BC layer, this condition should be removed after removing support for symfony < 5.3
+ if (!method_exists($type, 'getCollectionValueTypes')) {
+ return null !== $type->getCollectionValueType() ? [$type->getCollectionValueType()] : [];
+ }
+
+ return $type->getCollectionValueTypes();
+ }
+
private function getCollectionValueType(Type $type): ?Type
{
// BC layer, this condition should be removed after removing support for symfony < 5.3
diff --git a/ModelDescriber/Annotations/OpenApiAnnotationsReader.php b/ModelDescriber/Annotations/OpenApiAnnotationsReader.php
index 020b8b1..a7d20f1 100644
--- a/ModelDescriber/Annotations/OpenApiAnnotationsReader.php
+++ b/ModelDescriber/Annotations/OpenApiAnnotationsReader.php
@@ -15,16 +15,19 @@ use Doctrine\Common\Annotations\Reader;
use Nelmio\ApiDocBundle\Model\ModelRegistry;
use Nelmio\ApiDocBundle\OpenApiPhp\ModelRegister;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
-use OpenApi\Analyser;
+use Nelmio\ApiDocBundle\Util\SetsContextTrait;
use OpenApi\Analysis;
use OpenApi\Annotations as OA;
use OpenApi\Context;
+use OpenApi\Generator;
/**
* @internal
*/
class OpenApiAnnotationsReader
{
+ use SetsContextTrait;
+
private $annotationsReader;
private $modelRegister;
@@ -60,19 +63,20 @@ class OpenApiAnnotationsReader
return $default;
}
- return OA\UNDEFINED !== $oaProperty->property ? $oaProperty->property : $default;
+ return Generator::UNDEFINED !== $oaProperty->property ? $oaProperty->property : $default;
}
public function updateProperty($reflection, OA\Property $property, array $serializationGroups = null): void
{
// In order to have nicer errors
$declaringClass = $reflection->getDeclaringClass();
- Analyser::$context = new Context([
+
+ $this->setContext(new Context([
'namespace' => $declaringClass->getNamespaceName(),
'class' => $declaringClass->getShortName(),
'property' => $reflection->name,
'filename' => $declaringClass->getFileName(),
- ]);
+ ]));
/** @var OA\Property $oaProperty */
if ($reflection instanceof \ReflectionProperty && !$oaProperty = $this->annotationsReader->getPropertyAnnotation($reflection, OA\Property::class)) {
@@ -80,7 +84,7 @@ class OpenApiAnnotationsReader
} elseif ($reflection instanceof \ReflectionMethod && !$oaProperty = $this->annotationsReader->getMethodAnnotation($reflection, OA\Property::class)) {
return;
}
- Analyser::$context = null;
+ $this->setContext(null);
// Read @Model annotations
$this->modelRegister->__invoke(new Analysis([$oaProperty], Util::createContext()), $serializationGroups);
diff --git a/ModelDescriber/Annotations/PropertyPhpDocReader.php b/ModelDescriber/Annotations/PropertyPhpDocReader.php
index 5234b45..cd3f8de 100644
--- a/ModelDescriber/Annotations/PropertyPhpDocReader.php
+++ b/ModelDescriber/Annotations/PropertyPhpDocReader.php
@@ -12,6 +12,7 @@
namespace Nelmio\ApiDocBundle\ModelDescriber\Annotations;
use OpenApi\Annotations as OA;
+use OpenApi\Generator;
use phpDocumentor\Reflection\DocBlock\Tags\Var_;
use phpDocumentor\Reflection\DocBlockFactory;
@@ -53,10 +54,10 @@ class PropertyPhpDocReader
}
}
}
- if (OA\UNDEFINED === $property->title && $title) {
+ if (Generator::UNDEFINED === $property->title && $title) {
$property->title = $title;
}
- if (OA\UNDEFINED === $property->description && $docBlock->getDescription() && $docBlock->getDescription()->render()) {
+ if (Generator::UNDEFINED === $property->description && $docBlock->getDescription() && $docBlock->getDescription()->render()) {
$property->description = $docBlock->getDescription()->render();
}
}
diff --git a/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php b/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php
index aac6c1d..861bec3 100644
--- a/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php
+++ b/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php
@@ -14,6 +14,7 @@ namespace Nelmio\ApiDocBundle\ModelDescriber\Annotations;
use Doctrine\Common\Annotations\Reader;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use OpenApi\Annotations as OA;
+use OpenApi\Generator;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints as Assert;
@@ -79,7 +80,7 @@ class SymfonyConstraintAnnotationReader
return;
}
- $existingRequiredFields = OA\UNDEFINED !== $this->schema->required ? $this->schema->required : [];
+ $existingRequiredFields = Generator::UNDEFINED !== $this->schema->required ? $this->schema->required : [];
$existingRequiredFields[] = $propertyName;
$this->schema->required = array_values(array_unique($existingRequiredFields));
@@ -137,7 +138,7 @@ class SymfonyConstraintAnnotationReader
}
foreach ($this->schema->properties as $schemaProperty) {
if ($schemaProperty === $property) {
- return OA\UNDEFINED !== $schemaProperty->property ? $schemaProperty->property : null;
+ return Generator::UNDEFINED !== $schemaProperty->property ? $schemaProperty->property : null;
}
}
@@ -152,7 +153,7 @@ class SymfonyConstraintAnnotationReader
if (null === $newPattern) {
return;
}
- if (OA\UNDEFINED !== $property->pattern) {
+ if (Generator::UNDEFINED !== $property->pattern) {
$property->pattern = sprintf('%s, %s', $property->pattern, $newPattern);
} else {
$property->pattern = $newPattern;
diff --git a/ModelDescriber/FormModelDescriber.php b/ModelDescriber/FormModelDescriber.php
index a0f5c2a..370f8a6 100644
--- a/ModelDescriber/FormModelDescriber.php
+++ b/ModelDescriber/FormModelDescriber.php
@@ -18,6 +18,7 @@ use Nelmio\ApiDocBundle\Model\Model;
use Nelmio\ApiDocBundle\ModelDescriber\Annotations\AnnotationsReader;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use OpenApi\Annotations as OA;
+use OpenApi\Generator;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormConfigInterface;
@@ -101,7 +102,7 @@ final class FormModelDescriber implements ModelDescriberInterface, ModelRegistry
$property = Util::getProperty($schema, $name);
if ($config->getRequired()) {
- $required = OA\UNDEFINED !== $schema->required ? $schema->required : [];
+ $required = Generator::UNDEFINED !== $schema->required ? $schema->required : [];
$required[] = $name;
$schema->required = $required;
@@ -111,7 +112,7 @@ final class FormModelDescriber implements ModelDescriberInterface, ModelRegistry
$property->mergeProperties($config->getOption('documentation'));
}
- if (OA\UNDEFINED !== $property->type) {
+ if (Generator::UNDEFINED !== $property->type) {
continue; // Type manually defined
}
diff --git a/ModelDescriber/JMSModelDescriber.php b/ModelDescriber/JMSModelDescriber.php
index 129c432..9dc2c4e 100644
--- a/ModelDescriber/JMSModelDescriber.php
+++ b/ModelDescriber/JMSModelDescriber.php
@@ -23,6 +23,7 @@ use Nelmio\ApiDocBundle\Model\Model;
use Nelmio\ApiDocBundle\ModelDescriber\Annotations\AnnotationsReader;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use OpenApi\Annotations as OA;
+use OpenApi\Generator;
use Symfony\Component\PropertyInfo\Type;
/**
@@ -146,7 +147,7 @@ class JMSModelDescriber implements ModelDescriberInterface, ModelRegistryAwareIn
$annotationsReader->updateProperty($reflection, $property, $groups);
}
- if (OA\UNDEFINED !== $property->type || OA\UNDEFINED !== $property->ref) {
+ if (Generator::UNDEFINED !== $property->type || Generator::UNDEFINED !== $property->ref) {
$context->popPropertyMetadata();
continue;
diff --git a/ModelDescriber/ObjectModelDescriber.php b/ModelDescriber/ObjectModelDescriber.php
index c4c9b87..ca522f1 100644
--- a/ModelDescriber/ObjectModelDescriber.php
+++ b/ModelDescriber/ObjectModelDescriber.php
@@ -20,6 +20,7 @@ use Nelmio\ApiDocBundle\ModelDescriber\Annotations\AnnotationsReader;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use Nelmio\ApiDocBundle\PropertyDescriber\PropertyDescriberInterface;
use OpenApi\Annotations as OA;
+use OpenApi\Generator;
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
use Symfony\Component\PropertyInfo\Type;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
@@ -81,7 +82,7 @@ class ObjectModelDescriber implements ModelDescriberInterface, ModelRegistryAwar
$annotationsReader->updateDefinition($reflClass, $schema);
$discriminatorMap = $this->doctrineReader->getClassAnnotation($reflClass, DiscriminatorMap::class);
- if ($discriminatorMap && OA\UNDEFINED === $schema->discriminator) {
+ if ($discriminatorMap && Generator::UNDEFINED === $schema->discriminator) {
$this->applyOpenApiDiscriminator(
$model,
$schema,
@@ -123,7 +124,7 @@ class ObjectModelDescriber implements ModelDescriberInterface, ModelRegistryAwar
}
// If type manually defined
- if (OA\UNDEFINED !== $property->type || OA\UNDEFINED !== $property->ref) {
+ if (Generator::UNDEFINED !== $property->type || Generator::UNDEFINED !== $property->ref) {
continue;
}
diff --git a/OpenApiPhp/DefaultOperationId.php b/OpenApiPhp/DefaultOperationId.php
index b923b8c..0a30fce 100644
--- a/OpenApiPhp/DefaultOperationId.php
+++ b/OpenApiPhp/DefaultOperationId.php
@@ -13,6 +13,7 @@ namespace Nelmio\ApiDocBundle\OpenApiPhp;
use OpenApi\Analysis;
use OpenApi\Annotations as OA;
+use OpenApi\Generator;
/**
* Disable the OperationId processor from zircote/swagger-php as it breaks our documentation by setting non-unique operation ids.
@@ -27,7 +28,7 @@ final class DefaultOperationId
$allOperations = $analysis->getAnnotationsOfType(OA\Operation::class);
foreach ($allOperations as $operation) {
- if (OA\UNDEFINED === $operation->operationId) {
+ if (Generator::UNDEFINED === $operation->operationId) {
$operation->operationId = null;
}
}
diff --git a/OpenApiPhp/Util.php b/OpenApiPhp/Util.php
index ba97ede..cb57de1 100644
--- a/OpenApiPhp/Util.php
+++ b/OpenApiPhp/Util.php
@@ -13,7 +13,7 @@ namespace Nelmio\ApiDocBundle\OpenApiPhp;
use OpenApi\Annotations as OA;
use OpenApi\Context;
-use const OpenApi\UNDEFINED;
+use OpenApi\Generator;
/**
* Class Util.
@@ -163,7 +163,7 @@ final class Util
$nested = $parent::$_nested;
$property = $nested[$class];
- if (null === $parent->{$property} || UNDEFINED === $parent->{$property}) {
+ if (null === $parent->{$property} || Generator::UNDEFINED === $parent->{$property}) {
$parent->{$property} = self::createChild($parent, $class, $properties);
}
@@ -192,7 +192,7 @@ final class Util
if (!empty($properties)) {
$key = self::searchCollectionItem(
- $parent->{$collection} && UNDEFINED !== $parent->{$collection} ? $parent->{$collection} : [],
+ $parent->{$collection} && Generator::UNDEFINED !== $parent->{$collection} ? $parent->{$collection} : [],
$properties
);
}
@@ -224,7 +224,7 @@ final class Util
[$collection, $property] = $nested[$class];
$key = self::searchIndexedCollectionItem(
- $parent->{$collection} && UNDEFINED !== $parent->{$collection} ? $parent->{$collection} : [],
+ $parent->{$collection} && Generator::UNDEFINED !== $parent->{$collection} ? $parent->{$collection} : [],
$property,
$value
);
@@ -279,7 +279,7 @@ final class Util
*/
public static function createCollectionItem(OA\AbstractAnnotation $parent, $collection, $class, array $properties = []): int
{
- if (UNDEFINED === $parent->{$collection}) {
+ if (Generator::UNDEFINED === $parent->{$collection}) {
$parent->{$collection} = [];
}
@@ -418,7 +418,7 @@ final class Util
if (\is_string($type) && 0 === strpos($type, '[')) {
$innerType = substr($type, 1, -1);
- if (!$annotation->{$propertyName} || UNDEFINED === $annotation->{$propertyName}) {
+ if (!$annotation->{$propertyName} || Generator::UNDEFINED === $annotation->{$propertyName}) {
$annotation->{$propertyName} = [];
}
diff --git a/PropertyDescriber/CompoundPropertyDescriber.php b/PropertyDescriber/CompoundPropertyDescriber.php
index ba6cf6c..17801d1 100644
--- a/PropertyDescriber/CompoundPropertyDescriber.php
+++ b/PropertyDescriber/CompoundPropertyDescriber.php
@@ -15,6 +15,7 @@ use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareInterface;
use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareTrait;
use Nelmio\ApiDocBundle\OpenApiPhp\Util;
use OpenApi\Annotations as OA;
+use OpenApi\Generator;
class CompoundPropertyDescriber implements PropertyDescriberInterface, ModelRegistryAwareInterface
{
@@ -30,7 +31,7 @@ class CompoundPropertyDescriber implements PropertyDescriberInterface, ModelRegi
public function describe(array $types, OA\Schema $property, array $groups = null)
{
- $property->oneOf = OA\UNDEFINED !== $property->oneOf ? $property->oneOf : [];
+ $property->oneOf = Generator::UNDEFINED !== $property->oneOf ? $property->oneOf : [];
foreach ($types as $type) {
$property->oneOf[] = $schema = Util::createChild($property, OA\Schema::class, []);
diff --git a/PropertyDescriber/ObjectPropertyDescriber.php b/PropertyDescriber/ObjectPropertyDescriber.php
index d5836c0..34361d8 100644
--- a/PropertyDescriber/ObjectPropertyDescriber.php
+++ b/PropertyDescriber/ObjectPropertyDescriber.php
@@ -29,10 +29,7 @@ class ObjectPropertyDescriber implements PropertyDescriberInterface, ModelRegist
$types[0]->getClassName(),
$types[0]->isCollection(),
// BC layer for symfony < 5.3
- method_exists($types[0], 'getCollectionKeyTypes') ?
- ($types[0]->getCollectionKeyTypes()[0] ?? null) :
- $types[0]->getCollectionKeyType(),
- // BC layer for symfony < 5.3
+ method_exists($types[0], 'getCollectionKeyTypes') ? $types[0]->getCollectionKeyTypes() : $types[0]->getCollectionKeyType(),
method_exists($types[0], 'getCollectionValueTypes') ?
($types[0]->getCollectionValueTypes()[0] ?? null) :
$types[0]->getCollectionValueType()
diff --git a/Render/Html/GetNelmioAsset.php b/Render/Html/GetNelmioAsset.php
index be64283..0ec88f9 100644
--- a/Render/Html/GetNelmioAsset.php
+++ b/Render/Html/GetNelmioAsset.php
@@ -31,7 +31,7 @@ class GetNelmioAsset extends AbstractExtension
$this->resourcesDir = __DIR__.'/../../Resources/public';
}
- public function getFunctions()
+ public function getFunctions(): array
{
return [
new TwigFunction('nelmioAsset', $this, ['is_safe' => ['html']]),
diff --git a/Resources/doc/index.rst b/Resources/doc/index.rst
index 9daa3ea..95e2944 100644
--- a/Resources/doc/index.rst
+++ b/Resources/doc/index.rst
@@ -39,7 +39,7 @@ Open a command console, enter your project directory and execute the following c
class AppKernel extends Kernel
{
- public function registerBundles()
+ public function registerBundles(): iterable
{
$bundles = [
// ...
diff --git a/Resources/views/SwaggerUi/index.html.twig b/Resources/views/SwaggerUi/index.html.twig
index a711c25..fac6ea3 100644
--- a/Resources/views/SwaggerUi/index.html.twig
+++ b/Resources/views/SwaggerUi/index.html.twig
@@ -51,13 +51,16 @@ file that was distributed with this source code. #}
{% endblock svg_icons %}
-
-
- {% endblock header %}
-
+
+ {% endblock header %}
+