Skip to content

[Transform] Deprecate StaticCallToMethodCallRector as risky constructor injection, never used - #8759

Merged
TomasVotruba merged 2 commits into
mainfrom
tv-deprecate-static-call-to-method-call
Oct 21, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
tv-deprecate-static-call-to-method-call

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Deprecates StaticCallToMethodCallRector.

This generic configurable rule turns a static call into a service method call by injecting the service through the constructor. That is risky - the service may not belong in the class, the constructor may be unsuitable for injection, and the method signature rarely matches. It is a legacy rule that fits few real cases.

Following the same path as the already deprecated sibling FuncCallToMethodCallRector, downstream users should write a custom rule for their exact project case instead.

Changes:

  • mark the rule DeprecatedInterface + @deprecated, gut refactor() to throw
  • drop the now orphaned FuncCallStaticCallToMethodCallAnalyzer, TypeProvidingExprFromClassResolver, PropertyFetchFactory and the unused ClassDependencyManipulator::hasFinalParentConstructor()
  • keep the StaticCallToMethodCall value object (@api) for existing configs
  • remove the rule tests

@TomasVotruba
TomasVotruba enabled auto-merge (squash) October 21, 2026 22:42
@TomasVotruba
TomasVotruba merged commit f954e0c into main Oct 21, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-deprecate-static-call-to-method-call branch October 21, 2026 22:43
@TomasVotruba TomasVotruba changed the title [Transform] Deprecate StaticCallToMethodCallRector as risky constructor injection [Transform] Deprecate StaticCallToMethodCallRector as risky constructor injection, never used Oct 21, 2026
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