Skip to content

Commit 3aad2cc

Browse files
committed
use TypeHelper
1 parent 568249e commit 3aad2cc

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Metadata/Resource/Factory/ParameterResourceMetadataCollectionFactory.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
2929
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
3030
use ApiPlatform\Metadata\ResourceClassResolverInterface;
31+
use ApiPlatform\Metadata\Util\TypeHelper;
3132
use ApiPlatform\OpenApi\Model\Parameter as OpenApiParameter;
3233
use ApiPlatform\Serializer\Filter\FilterInterface as SerializerFilterInterface;
3334
use ApiPlatform\State\Parameter\ValueCaster;
@@ -179,15 +180,11 @@ private function getClassFromProperty(ApiProperty $propertyMetadata): ?string
179180

180181
private function extractClassNameFromType(Type $type): ?string
181182
{
182-
if ($type instanceof CollectionType) {
183-
return $this->extractClassNameFromType($type->getCollectionValueType());
183+
if ($collectionValueType = TypeHelper::getCollectionValueType($type)) {
184+
return TypeHelper::getClassName($collectionValueType);
184185
}
185186

186-
if ($type instanceof ObjectType) {
187-
return $type->getClassName();
188-
}
189-
190-
return null;
187+
return TypeHelper::getClassName($type);
191188
}
192189

193190
private function getDefaultParameters(Operation $operation, string $resourceClass, int &$internalPriority): Parameters

0 commit comments

Comments
 (0)