Skip to content

Conversation

@samsonasik
Copy link
Collaborator

@samsonasik samsonasik commented Dec 7, 2025

since beforeTraverse() become final,

the use of beforeTraverse here is invalid,

Using custom node visitor is not ideal for shareable rules, since user then need another step to register visitor, this PR make it keep working automatically, by register on global Node early on the particular rules that requires set attributes.

@samsonasik
Copy link
Collaborator Author

@GeniJaho @driftingly @peterfox Ready to merge 👍

after this PR merged, I think new immediate release is needed so next composer update when sometime rector released new version, there will be less to no regression as possible :)

@samsonasik
Copy link
Collaborator Author

For note: after next rector release, which new FileNode will exists, instead of global node that can be any node, the FileNode and Namespace_ should be used instead as a "top" node :)

This PR ensure keep work first whenever next rector release anytime soon when we are may not available to immediatelly patch :)

@samsonasik
Copy link
Collaborator Author

@GeniJaho @driftingly @peterfox I've bumped to latest rector ^2.2.13 and fix compatible code:

  • ensure use isInFirstLevelStatement() from scope to reduce repetitive init traverse 9cc30cf
  • fix patch of static SimpleCallableNodeTraverser::traverseNodesWithCallable usage c1e50cc

Ready to merge and this needs immediate new release :)

@peterfox
Copy link
Collaborator

peterfox commented Dec 9, 2025

Looks good. I'm wandering if what we need is a mechanism where a default config is loaded with the Laravel Package or the package has it's own Config object at this point that preloads a few things. Then we could use NodeVisitors.

This will be good to resolve the current situation.

@peterfox peterfox merged commit ffb6316 into driftingly:main Dec 9, 2025
5 checks passed
@samsonasik samsonasik deleted the move-before-traverse-to-global-node branch December 9, 2025 18:30
@samsonasik
Copy link
Collaborator Author

There is default config:

https://github.com/driftingly/rector-laravel/blob/main/config/config.php

already included in sets, but then user that only want to use single rule and done, will require manually include it, that's another step for user.

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