diff --git a/rules/Php80/Rector/Property/NestedAnnotationToAttributeRector.php b/rules/Php80/Rector/Property/NestedAnnotationToAttributeRector.php index 78ac6a21d70..c5f4434b06f 100644 --- a/rules/Php80/Rector/Property/NestedAnnotationToAttributeRector.php +++ b/rules/Php80/Rector/Property/NestedAnnotationToAttributeRector.php @@ -4,6 +4,7 @@ namespace Rector\Php80\Rector\Property; +use PhpParser\Comment\Doc; use PhpParser\Node; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Param; @@ -106,6 +107,11 @@ public function getNodeTypes(): array */ public function refactor(Node $node): ?Node { + // nested annotations converted to attributes only come from a docblock; skip nodes without one + if (!$node->getDocComment() instanceof Doc) { + return null; + } + $phpDocInfo = $this->phpDocInfoFactory->createFromNode($node); if (! $phpDocInfo instanceof PhpDocInfo) { return null;