diff --git a/src/Application/ChangedNodeScopeRefresher.php b/src/Application/ChangedNodeScopeRefresher.php index 2c06ca34b11..b6c653099ed 100644 --- a/src/Application/ChangedNodeScopeRefresher.php +++ b/src/Application/ChangedNodeScopeRefresher.php @@ -149,6 +149,10 @@ private function setLineAttributesOnClass(Class_ $class, Attribute|AttributeGrou $this->simpleCallableNodeTraverser->traverseNodesWithCallable([$class], function (Node $subNode) use ( $node ): Node { + if ($subNode->getStartLine() > 0 && $subNode->getEndLine() > 0) { + return $subNode; + } + $subNode->setAttribute('startLine', $node->getStartLine()); $subNode->setAttribute('endLine', $node->getEndLine());