diff --git a/src/Analysers/AttributeAnnotationFactory.php b/src/Analysers/AttributeAnnotationFactory.php index c93609a2..3262e0dc 100644 --- a/src/Analysers/AttributeAnnotationFactory.php +++ b/src/Analysers/AttributeAnnotationFactory.php @@ -139,9 +139,9 @@ public function build(\Reflector $reflector, Context $context): array } } - // Property can be nested... - return $annotation->getRoot() != $possibleParent->getRoot() - && ($explicitParent || ($isAttachable && $isParentAllowed)); + // Attachables can always be nested (unless explicitly restricted) + return ($isAttachable && $isParentAllowed) + || ($annotation->getRoot() != $possibleParent->getRoot() && $explicitParent); }; $annotationsWithoutParent = [];