@@ -6291,16 +6291,17 @@ private function processTraitUse(Node\Stmt\TraitUse $node, MutatingScope $classS
6291
6291
$ adaptations [] = $ adaptation ;
6292
6292
}
6293
6293
$ parserNodes = $ this ->parser ->parseFile ($ fileName );
6294
- $ this ->processNodesForTraitUse ($ parserNodes , $ traitReflection , $ classScope , $ adaptations , $ nodeCallback );
6294
+ $ this ->processNodesForTraitUse ($ parserNodes , $ parserNodes , $ traitReflection , $ classScope , $ adaptations , $ nodeCallback );
6295
6295
}
6296
6296
}
6297
6297
6298
6298
/**
6299
+ * @param Node\Stmt[] $parserNodes
6299
6300
* @param Node[]|Node|scalar|null $node
6300
6301
* @param Node\Stmt\TraitUseAdaptation[] $adaptations
6301
6302
* @param callable(Node $node, Scope $scope): void $nodeCallback
6302
6303
*/
6303
- private function processNodesForTraitUse ($ node , ClassReflection $ traitReflection , MutatingScope $ scope , array $ adaptations , callable $ nodeCallback ): void
6304
+ private function processNodesForTraitUse (array $ parserNodes , $ node , ClassReflection $ traitReflection , MutatingScope $ scope , array $ adaptations , callable $ nodeCallback ): void
6304
6305
{
6305
6306
if ($ node instanceof Node) {
6306
6307
if ($ node instanceof Node \Stmt \Trait_ && $ traitReflection ->getName () === (string ) $ node ->namespacedName && $ traitReflection ->getNativeReflection ()->getStartLine () === $ node ->getStartLine ()) {
@@ -6347,7 +6348,7 @@ private function processNodesForTraitUse($node, ClassReflection $traitReflection
6347
6348
throw new ShouldNotHappenException ();
6348
6349
}
6349
6350
$ traitScope = $ scope ->enterTrait ($ traitReflection );
6350
- $ nodeCallback (new InTraitNode ($ node , $ traitReflection , $ scope ->getClassReflection ()), $ traitScope );
6351
+ $ nodeCallback (new InTraitNode ($ node , $ parserNodes , $ traitReflection , $ scope ->getClassReflection ()), $ traitScope );
6351
6352
$ this ->processStmtNodes ($ node , $ stmts , $ traitScope , $ nodeCallback , StatementContext::createTopLevel ());
6352
6353
return ;
6353
6354
}
@@ -6359,11 +6360,11 @@ private function processNodesForTraitUse($node, ClassReflection $traitReflection
6359
6360
}
6360
6361
foreach ($ node ->getSubNodeNames () as $ subNodeName ) {
6361
6362
$ subNode = $ node ->{$ subNodeName };
6362
- $ this ->processNodesForTraitUse ($ subNode , $ traitReflection , $ scope , $ adaptations , $ nodeCallback );
6363
+ $ this ->processNodesForTraitUse ($ parserNodes , $ subNode , $ traitReflection , $ scope , $ adaptations , $ nodeCallback );
6363
6364
}
6364
6365
} elseif (is_array ($ node )) {
6365
6366
foreach ($ node as $ subNode ) {
6366
- $ this ->processNodesForTraitUse ($ subNode , $ traitReflection , $ scope , $ adaptations , $ nodeCallback );
6367
+ $ this ->processNodesForTraitUse ($ parserNodes , $ subNode , $ traitReflection , $ scope , $ adaptations , $ nodeCallback );
6367
6368
}
6368
6369
}
6369
6370
}
0 commit comments