Repository navigation
[scope] Stop attaching scope to class extends/implements names - #8788
Merged
Merged
Conversation
TomasVotruba
marked this pull request as draft
October 23, 2026 16:28
TomasVotruba
marked this pull request as ready for review
October 23, 2026 19:07
…_ level Stop attaching scope to extends/implements names in PHPStanNodeScopeResolver. RenameClassRector now resolves class extends rename on the Class_ node, using the class own name for the self-extends guard instead of scope.
TomasVotruba
force-pushed
the
tv-traverse-scope
branch
from
October 23, 2026 19:07
be11cb4 to
6330666
Compare
samsonasik
reviewed
Oct 23, 2026
Comment on lines
+168
to
+169
| // why not simply this everywhere? what would we lose? | ||
| // $node->setAttribute(AttributeKey::SCOPE, $mutatingScope); |
Member
There was a problem hiding this comment.
I tried rector dev-main on symfony project, this cause crash
Member
There was a problem hiding this comment.
Member
There was a problem hiding this comment.
I created issue for it:
Member
Author
Can you add this as a CI workflow check? So we have instant feedback. |
Member
|
It seems only reproduced via https://github.com/samsonasik/symfony-container-error-rector/blob/main/README.md |
Member
|
@TomasVotruba I created a PR for failing test case on crash with Attribute closure |
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 free
to 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.
Removes scope attachment from
extends/implementsnames inPHPStanNodeScopeResolver, and moves classextendsrenaming inRenameClassRectoronto theClass_node level so the self-extends guard no longer needs scope.The old self-extends check read
$scope->getClassReflection()->getName()on the extends name node. With scope gone from names,RenameClassRectornow resolves the enclosing class name directly from theClass_node and skips the rename when the class would extend itself.Namepath skipsIS_CLASS_EXTENDS; interfaceextendsis unaffected (no such attribute on those).