From 3b6f3800f4fd6544ada4dce180c6b69eaead7c7c Mon Sep 17 00:00:00 2001 From: Martin Rademacher Date: Wed, 9 Oct 2024 16:11:12 +1300 Subject: [PATCH] Allow nesting of `Attachable` annotations (#1663) --- src/Analysers/AttributeAnnotationFactory.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 = [];