diff --git a/src/TypeGenerator.php b/src/TypeGenerator.php index 8202b5c..8ff50d4 100644 --- a/src/TypeGenerator.php +++ b/src/TypeGenerator.php @@ -90,7 +90,7 @@ protected function extractTypeFromPropertyType(Type $propertyType): string $propertyTypeString = $propertyType->getClassName() ?? $propertyBuiltInType; return match (true) { - $propertyType->isCollection() => $this->extractCollectionType($propertyTypeString, $propertyType->getCollectionValueTypes()), + $propertyType->isCollection() || is_a($propertyTypeString, Collection::class, true) => $this->extractCollectionType($propertyTypeString, $propertyType->getCollectionValueTypes()), is_a($propertyTypeString, Model::class, true) => $this->extractModelType($propertyTypeString), is_a($propertyTypeString, \BackedEnum::class, true) => $this->extractEnumType($propertyTypeString), $propertyBuiltInType === 'object' && $propertyBuiltInType !== $propertyTypeString => $this->extractObjectType($propertyTypeString),