Skip to content

Deprecate AddParamStringTypeFromSprintfUseRector - #8723

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-add-param-string-type-from-sprintf
Oct 20, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
deprecate-add-param-string-type-from-sprintf

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

The sprintf() %s mask does not guarantee a string parameter. PHP silently converts int and float arguments to string inside sprintf(), so forcing a string param type on a value only used in a sprintf call can add an invalid, too-narrow type.

This deprecates the rule:

  • gut the body to throw on refactor(), mark with DeprecatedInterface + @deprecated
  • drop the rule from TypeDeclarationLevel
  • remove the test directory and the now-orphaned VariableInSprintfMaskMatcher

The sprintf %s mask does not guarantee a string parameter. PHP silently
converts int and float arguments to string in sprintf, so forcing a string
param type can add an invalid, too-narrow type.
@TomasVotruba
TomasVotruba merged commit ee09064 into main Oct 20, 2026
48 of 49 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-add-param-string-type-from-sprintf branch October 20, 2026 10:04
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