Skip to content

Conversation

@samsonasik
Copy link
Member

similar with PR:

the process already done on beforeTraverse()

We stop the traversal because all the work has already been done in the beforeTraverse() function

Using STOP_TRAVERSAL is usually dangerous as it will stop the processing of all your nodes for all visitors
but since the PostFileProcessor is using direct new NodeTraverser() and traverse() for only a single
visitor per execution, using stop traversal here is safe,

ref

$nodeTraverser = new NodeTraverser();
$nodeTraverser->addVisitor($postRector);
$stmts = $nodeTraverser->traverse($stmts);

@samsonasik
Copy link
Member Author

samsonasik commented Sep 16, 2025

PHPStan notice seems due to new PHPStan release

https://github.com/phpstan/phpstan/releases/tag/2.1.26

I will fix phpstan notice in separate PR.

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 317ba55 into main Sep 16, 2025
49 checks passed
@samsonasik samsonasik deleted the stop-on-enter-node-class-renamign branch September 16, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants