Skip to content

[scope] Stop attaching scope to class extends/implements names - #8788

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-traverse-scope
Oct 23, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-traverse-scope

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Removes scope attachment from extends/implements names in PHPStanNodeScopeResolver, and moves class extends renaming in RenameClassRector onto the Class_ 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, RenameClassRector now resolves the enclosing class name directly from the Class_ node and skips the rename when the class would extend itself.

Name path skips IS_CLASS_EXTENDS; interface extends is unaffected (no such attribute on those).

@TomasVotruba
TomasVotruba marked this pull request as draft October 23, 2026 16:28
@TomasVotruba TomasVotruba changed the title Stop attaching scope to class extends/implements names [scope] Stop attaching scope to class extends/implements names Oct 23, 2026
@TomasVotruba
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
TomasVotruba merged commit fb4503d into main Oct 23, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-traverse-scope branch October 23, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant