Skip to content

[Naming] Deprecate RenameVariableToMatchMethodCallReturnTypeRector - #8549

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-rename-variable-to-method-call-return-type
Oct 8, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
deprecate-rename-variable-to-method-call-return-type

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Deprecates RenameVariableToMatchMethodCallReturnTypeRector.

Renaming a variable to match a method call return type is risky - it can clobber meaningful, intentional local names and cause conflicts, while the existing name usually carries more context than the callee type.

The rule now implements DeprecatedInterface and throws on refactor(), keeping only getRuleDefinition() and getNodeTypes().

Cleanup of now-orphaned internals used only by this rule:

  • removed Rector\Naming\Matcher\VariableAndCallAssignMatcher
  • removed Rector\Naming\ValueObject\VariableAndCallAssign
  • removed ExpectedNameResolver::resolveForCall()
  • narrowed CallMatcher::matchCall() param to Foreach_ (only remaining caller type)

Unregistered from config/set/naming.php and removed from the Issue7112 combination config (kept AddVoidReturnTypeWhereNoReturnRector). Rule tests removed.

@TomasVotruba
TomasVotruba enabled auto-merge (squash) October 8, 2026 19:29
@TomasVotruba
TomasVotruba force-pushed the deprecate-rename-variable-to-method-call-return-type branch from 34130cb to e123094 Compare October 8, 2026 19:40
@TomasVotruba
TomasVotruba force-pushed the deprecate-rename-variable-to-method-call-return-type branch from e123094 to b2d1979 Compare October 8, 2026 19:43
@TomasVotruba
TomasVotruba merged commit 4ce8c13 into main Oct 8, 2026
50 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-rename-variable-to-method-call-return-type branch October 8, 2026 19:45
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