diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index 4487c63979..0c4fa06a7b 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -2587,7 +2587,7 @@ private function processTraitUse(Node\Stmt\TraitUse $node, MutatingScope $classS private function processNodesForTraitUse($node, ClassReflection $traitReflection, MutatingScope $scope, \Closure $nodeCallback): void { if ($node instanceof Node) { - if ($node instanceof Node\Stmt\Trait_ && $traitReflection->getName() === (string) $node->namespacedName) { + if ($node instanceof Node\Stmt\Trait_ && $traitReflection->getName() === (string) $node->namespacedName && $traitReflection->getNativeReflection()->getStartLine() === $node->getStartLine()) { $this->processStmtNodes($node, $node->stmts, $scope->enterTrait($traitReflection), $nodeCallback); return; }