Skip to content

[CodingStyle] Deprecate EncapsedStringsToSprintfRector - #8265

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-encapsed-strings-to-sprintf
Aug 2, 2026
Merged

[CodingStyle] Deprecate EncapsedStringsToSprintfRector#8265
TomasVotruba merged 1 commit into
mainfrom
deprecate-encapsed-strings-to-sprintf

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Deprecate EncapsedStringsToSprintfRector.

Turning string interpolation into sprintf()/concat is a personal preference, not a correctness or upgrade change. On top of that, the rule output is ambiguous - the same input produces a different result depending on the value type and the always configuration:

-echo "Unsupported format {$format} - use another";
+echo sprintf('Unsupported format %s - use another', $format);

-echo "Try {$allowed}";
+echo 'Try ' . $allowed;

Same input, two different output styles - one sprintf(), one concat. With always: true the second one becomes sprintf() too. Hard to predict, and the "more readable" claim goes both ways.

Rule is kept as a deprecated no-op that throws when used, and removed from the CodingStyle level.

@TomasVotruba
TomasVotruba merged commit e8816ca into main Aug 2, 2026
64 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-encapsed-strings-to-sprintf branch August 2, 2026 21:57
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