Skip to content

Commit

Permalink
fix: use iterable check instead of array (#2239)
Browse files Browse the repository at this point in the history
  • Loading branch information
DjordyKoert committed Mar 7, 2024
1 parent db467dc commit a15b592
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ModelDescriber/ObjectModelDescriber.php
Expand Up @@ -57,7 +57,7 @@ public function __construct(
bool $useValidationGroups = false,
ClassMetadataFactoryInterface $classMetadataFactory = null
) {
if (is_array($propertyDescribers)) {
if (is_iterable($propertyDescribers)) {
trigger_deprecation('nelmio/api-doc-bundle', '4.17', 'Passing an array of PropertyDescriberInterface to %s() is deprecated. Pass a single PropertyDescriberInterface instead.', __METHOD__);
} else {
if (!$propertyDescribers instanceof PropertyDescriberInterface) {
Expand Down Expand Up @@ -202,7 +202,7 @@ private function camelize(string $string): string
*/
private function describeProperty(array $types, Model $model, OA\Schema $property, string $propertyName, OA\Schema $schema)
{
$propertyDescribers = is_array($this->propertyDescriber) ? $this->propertyDescriber : [$this->propertyDescriber];
$propertyDescribers = is_iterable($this->propertyDescriber) ? $this->propertyDescriber : [$this->propertyDescriber];

foreach ($propertyDescribers as $propertyDescriber) {
if ($propertyDescriber instanceof ModelRegistryAwareInterface) {
Expand Down

0 comments on commit a15b592

Please sign in to comment.