Skip to content

Commit 885ba02

Browse files
authored
[internal] Traverse DecoratingNodeVisitorInterface after scope filling on PHPStanNodeScopeResolver::processNodes() (#7729)
* [internal] Traverse DecoratingNodeVisitorInterface after scope filling on PHPStanNodeScopeResolver::processNodes() * fix grammar * add link comment
1 parent 2c3d565 commit 885ba02

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ public function processNodes(
155155

156156
Assert::allIsInstanceOf($stmts, Stmt::class);
157157

158-
$this->nodeTraverser->traverse($stmts);
159-
160158
$scope = $formerMutatingScope ?? $this->scopeFactory->createFromFile($filePath);
161159

162160
$nodeCallback = function (Node $node, MutatingScope $mutatingScope) use (
@@ -419,6 +417,10 @@ public function processNodes(
419417
RectorNodeScopeResolver::processNodes($stmts, $scope);
420418
}
421419

420+
// use after scope filling so DecoratingNodeVisitorInterface instance can fetch the scope of target node
421+
// @see https://github.com/rectorphp/rector-src/pull/7721#discussion_r2595932460
422+
$this->nodeTraverser->traverse($stmts);
423+
422424
return $stmts;
423425
}
424426

0 commit comments

Comments
 (0)