@@ -6291,16 +6291,17 @@ private function processTraitUse(Node\Stmt\TraitUse $node, MutatingScope $classS
62916291 $ adaptations [] = $ adaptation ;
62926292 }
62936293 $ parserNodes = $ this ->parser ->parseFile ($ fileName );
6294- $ this ->processNodesForTraitUse ($ parserNodes , $ traitReflection , $ classScope , $ adaptations , $ nodeCallback );
6294+ $ this ->processNodesForTraitUse ($ parserNodes , $ parserNodes , $ traitReflection , $ classScope , $ adaptations , $ nodeCallback );
62956295 }
62966296 }
62976297
62986298 /**
6299+ * @param Node\Stmt[] $parserNodes
62996300 * @param Node[]|Node|scalar|null $node
63006301 * @param Node\Stmt\TraitUseAdaptation[] $adaptations
63016302 * @param callable(Node $node, Scope $scope): void $nodeCallback
63026303 */
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
63046305 {
63056306 if ($ node instanceof Node) {
63066307 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
63476348 throw new ShouldNotHappenException ();
63486349 }
63496350 $ traitScope = $ scope ->enterTrait ($ traitReflection );
6350- $ nodeCallback (new InTraitNode ($ node , $ traitReflection , $ scope ->getClassReflection ()), $ traitScope );
6351+ $ nodeCallback (new InTraitNode ($ node , $ parserNodes , $ traitReflection , $ scope ->getClassReflection ()), $ traitScope );
63516352 $ this ->processStmtNodes ($ node , $ stmts , $ traitScope , $ nodeCallback , StatementContext::createTopLevel ());
63526353 return ;
63536354 }
@@ -6359,11 +6360,11 @@ private function processNodesForTraitUse($node, ClassReflection $traitReflection
63596360 }
63606361 foreach ($ node ->getSubNodeNames () as $ subNodeName ) {
63616362 $ subNode = $ node ->{$ subNodeName };
6362- $ this ->processNodesForTraitUse ($ subNode , $ traitReflection , $ scope , $ adaptations , $ nodeCallback );
6363+ $ this ->processNodesForTraitUse ($ parserNodes , $ subNode , $ traitReflection , $ scope , $ adaptations , $ nodeCallback );
63636364 }
63646365 } elseif (is_array ($ node )) {
63656366 foreach ($ node as $ subNode ) {
6366- $ this ->processNodesForTraitUse ($ subNode , $ traitReflection , $ scope , $ adaptations , $ nodeCallback );
6367+ $ this ->processNodesForTraitUse ($ parserNodes , $ subNode , $ traitReflection , $ scope , $ adaptations , $ nodeCallback );
63676368 }
63686369 }
63696370 }
0 commit comments