phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

Report invalid printf placeholder

Open VincentLanglet opened this issue 4 months ago • 3 comments

Closes https://github.com/phpstan/phpstan/issues/1889 Closes https://github.com/phpstan/phpstan/issues/8547 (cc @staabm)

VincentLanglet avatar Oct 24 '25 21:10 VincentLanglet

This pull request has been marked as ready for review.

phpstan-bot avatar Oct 24 '25 22:10 phpstan-bot

Also maybe this belongs to bleeding edge only?

ondrejmirtes avatar Oct 25 '25 07:10 ondrejmirtes

Also maybe this belongs to bleeding edge only?

I would have consider this kinda as a "bugfix". Technically the sprintf('%') call should have been reported since there is was missing parameter https://3v4l.org/lAIAAs

I can put this behind bleeding edge, but that would mean adding an extra parameters to getPrintfPlaceholdersCount methods with something like getPrintfPlaceholdersCount($format, $reportInvalidPlaceholder). It's your call !

VincentLanglet avatar Oct 25 '25 13:10 VincentLanglet