Skip to content

Commit

Permalink
fix Illuminate’s collections without collected type on types generation
Browse files Browse the repository at this point in the history
  • Loading branch information
d8vjork committed Oct 12, 2023
1 parent 3764357 commit 38a2097
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/TypeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 38a2097

Please sign in to comment.