Skip to content

[Unambiguous] Deprecate FluentSettersToStandaloneCallMethodRector and RemoveReturnThisFromSetterClassMethodRector - #8473

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-unambiguous-fluent-setter-rules
Sep 8, 2026
Merged

[Unambiguous] Deprecate FluentSettersToStandaloneCallMethodRector and RemoveReturnThisFromSetterClassMethodRector#8473
TomasVotruba merged 1 commit into
mainfrom
deprecate-unambiguous-fluent-setter-rules

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Both rules are orphans (in no set) and depend too much on the use case to run generically:

  • FluentSettersToStandaloneCallMethodRector - breaks a fluent setter chain into standalone calls. The safe transformation differs per method return semantics.
  • RemoveReturnThisFromSetterClassMethodRector - drops return $this from setters. The setter may be part of a fluent public API that callers rely on, so the change can silently break code.

Both deprecated via the standard pattern: body throws, DeprecatedInterface + @deprecated, tests removed. The now-orphaned FluentMethodCallsCollector helper and the single-caller ClassMethodAndPropertyAnalyzer::hasPropertyAssignWithReturnThis() method are removed too.

… RemoveReturnThisFromSetterClassMethodRector

Both need a more complex approach depending on the use case - breaking a fluent chain or dropping return $this can silently change a public fluent API.
@TomasVotruba
TomasVotruba merged commit 96e88e1 into main Sep 8, 2026
41 of 43 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-unambiguous-fluent-setter-rules branch September 8, 2026 19:25
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