From 38a209702575dc20874e1ecc1edb6ab6d4d63429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Robles?= Date: Thu, 12 Oct 2023 20:02:52 +0200 Subject: [PATCH] =?UTF-8?q?fix=20Illuminate=E2=80=99s=20collections=20with?= =?UTF-8?q?out=20collected=20type=20on=20types=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/TypeGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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),