Skip to content

[Naming] Deprecate RenameForeachValueVariableToMatchExprVariableRector - #8548

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-rename-foreach-value-to-expr-variable
Oct 8, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
deprecate-rename-foreach-value-to-expr-variable

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Deprecates RenameForeachValueVariableToMatchExprVariableRector.

Renaming a foreach value variable to match the iterated expression variable is risky - it can clobber meaningful local names and cause conflicts, while offering little real value. The rule now implements DeprecatedInterface and throws on refactor(), mirroring the existing deprecation pattern.

Changes:

  • Gut the rule to a deprecation stub (keeps getRuleDefinition() and getNodeTypes())
  • Unregister it from config/set/naming.php
  • Remove its rules-tests/ directory

Cascade cleanup (orphaned by the removal, only consumer was this rule):

  • Rector\Naming\ExpectedNameResolver\InflectorSingularResolver and its test

@TomasVotruba
TomasVotruba force-pushed the deprecate-rename-foreach-value-to-expr-variable branch from 3751658 to e267947 Compare October 8, 2026 19:42
@TomasVotruba
TomasVotruba force-pushed the deprecate-rename-foreach-value-to-expr-variable branch from e267947 to f511342 Compare October 8, 2026 19:46
@TomasVotruba
TomasVotruba enabled auto-merge (squash) October 8, 2026 19:46
@TomasVotruba
TomasVotruba merged commit e77302a into main Oct 8, 2026
50 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-rename-foreach-value-to-expr-variable branch October 8, 2026 19:47
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