Uh oh!
There was an error while loading. Please reload this page.
Introduce FileNode to handle file-level changes - #7728
Merged
Conversation
TomasVotrubaforce-pushed
the
tv-rector-avoid-before-traverser
branch
2 times, most recently
from
December 7, 2025 11:59
3af10dd to
4263effCompareTomasVotrubaforce-pushed
the
tv-rector-avoid-before-traverser
branch
11 times, most recently
from
December 8, 2025 23:33
6d9c96d to
652b580CompareTomasVotrubaforce-pushed
the
tv-rector-avoid-before-traverser
branch
5 times, most recently
from
December 22, 2025 10:09
ec1edaa to
a4b2b44CompareUh oh!
There was an error while loading. Please reload this page.
TomasVotrubaforce-pushed
the
tv-rector-avoid-before-traverser
branch
from
December 22, 2025 10:24
a4b2b44 to
4af1f44CompareUh oh!
There was an error while loading. Please reload this page.
TomasVotrubaforce-pushed
the
tv-rector-avoid-before-traverser
branch
from
December 22, 2025 10:29
41954f4 to
3fc5f1eCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
TomasVotrubaforce-pushed
the
tv-rector-avoid-before-traverser
branch
from
December 22, 2025 13:04
3fc5f1e to
e53b2faCompareTomasVotrubaforce-pushed
the
tv-rector-avoid-before-traverser
branch
2 times, most recently
from
December 22, 2025 13:32
083efb3 to
cbc1c5eCompareUh oh!
There was an error while loading. Please reload this page.
…clareStrictTypesRector
TomasVotrubaforce-pushed
the
tv-rector-avoid-before-traverser
branch
from
December 22, 2025 15:19
6208ebe to
ff771b0Comparesamsonasik
approved these changes
Dec 22, 2025
TomasVotruba
commented
Dec 22, 2025
MemberAuthor
Let's ship it 👍 |
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Dec 23, 2025
Merged
Merged
TomasVotruba
commented
Dec 25, 2025
MemberAuthor
@samsonasik Just released 2.3 with |
TomasVotruba
commented
Dec 25, 2025
MemberAuthor
Here is upgrade guide for the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At the moment, there is no way to handle file-level operations, like adding
declare(...)to a file. We hack around this usingbeforeTraverse(), which is internal part ofphp-parserand should be avoided.This PR adds a
FileNodeto fix that. It allows to make changes directly inrefactor()method as it should be 👍It also opens-up possibility to have a single place to manage use statements (now handled by couple meta services). Next step will be marking
beforeTraverse()andafterTraverse()finalinAbstractRector, to keep BC promise only forRectorInterface(as it should be from the start).This PR keeps BC as much as possible and adds reporting about deprecation to in custom rules.
Use of
FileWithoutNamespace::classnode: https://github.com/search?q=%22FileWithoutNamespace%3A%3Aclass%22+NOT+is%3Afork&type=codeTodo
FileWithoutNamespacestill workgetNodeTypes()and explain upgrade pathRelated package PRs
FileNoderector-doctrine#474