propertyDescribers = $propertyDescribers; } public function describe(array $types, OA\Schema $property, array $groups = null) { // BC layer for symfony < 5.3 $type = method_exists($types[0], 'getCollectionValueTypes') ? ($types[0]->getCollectionValueTypes()[0] ?? null) : $types[0]->getCollectionValueType(); if (null === $type) { throw new UndocumentedArrayItemsException(); } $property->type = 'array'; $this->setNullableProperty($types[0], $property); $property = Util::getChild($property, OA\Items::class); foreach ($this->propertyDescribers as $propertyDescriber) { if ($propertyDescriber instanceof ModelRegistryAwareInterface) { $propertyDescriber->setModelRegistry($this->modelRegistry); } if ($propertyDescriber->supports([$type])) { try { $propertyDescriber->describe([$type], $property, $groups); } catch (UndocumentedArrayItemsException $e) { if (null !== $e->getClass()) { throw $e; // This exception is already complete } throw new UndocumentedArrayItemsException(null, sprintf('%s[]', $e->getPath())); } break; } } } public function supports(array $types): bool { return 1 === count($types) && $types[0]->isCollection(); } }