Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BaseData contract i/o Data concrete in CollectionAnnotation #928

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Support/Annotations/CollectionAnnotationReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context;
use ReflectionClass;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Contracts\BaseData;
use Spatie\LaravelData\Resolvers\ContextResolver;

class CollectionAnnotationReader
Expand Down Expand Up @@ -52,7 +52,7 @@ public function getForClass(string $className): ?CollectionAnnotation

return self::$cache[$className] = new CollectionAnnotation(
type: $type['valueType'],
isData: is_subclass_of($type['valueType'], Data::class),
isData: class_exists($type['valueType']) && in_array(BaseData::class, class_implements($type['valueType'])),
keyType: $type['keyType'] ?? 'array-key',
);
}
Expand Down
Loading