From 0a32b8682b7d39348b8c34965dd182fdd60e5094 Mon Sep 17 00:00:00 2001 From: louismariegaborit Date: Fri, 27 Jan 2023 13:59:52 +0100 Subject: [PATCH] fix(metadata): reader should be nullable --- .../Property/Factory/AnnotationSubresourceMetadataFactory.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Core/Metadata/Property/Factory/AnnotationSubresourceMetadataFactory.php b/src/Core/Metadata/Property/Factory/AnnotationSubresourceMetadataFactory.php index 998650e51e6..8f17f0922f2 100644 --- a/src/Core/Metadata/Property/Factory/AnnotationSubresourceMetadataFactory.php +++ b/src/Core/Metadata/Property/Factory/AnnotationSubresourceMetadataFactory.php @@ -83,6 +83,10 @@ public function create(string $resourceClass, string $property, array $options = return $this->updateMetadata($attributes[0]->newInstance(), $propertyMetadata, $resourceClass, $property); } + if (!$this->reader) { + return $propertyMetadata; + } + $annotation = $this->reader->getMethodAnnotation($reflectionMethod, ApiSubresource::class); if ($annotation instanceof ApiSubresource) { return $this->updateMetadata($annotation, $propertyMetadata, $resourceClass, $property);