Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printf with width format is not recognized #9674

Closed
fmarchalemisys opened this issue Jul 24, 2023 · 2 comments · Fixed by phpstan/phpstan-src#2543
Closed

Printf with width format is not recognized #9674

fmarchalemisys opened this issue Jul 24, 2023 · 2 comments · Fixed by phpstan/phpstan-src#2543
Labels
Milestone

Comments

@fmarchalemisys
Copy link

Bug report

As per the php doc for printf-like functions:

Width

Either an integer that says how many characters (minimum) this conversion should result in, or *. If * is used, then the width is supplied as an additional integer value preceding the one formatted by the specifier.

If * is used as the width, phpstan complains about Call to printf contains 0 placeholders, 2 values given.

printf("%0*d", 5, 1);

Code snippet that reproduces the problem

https://phpstan.org/r/5b266f50-2c92-41c3-a374-72df3982d659

Expected output

Phpstan should detect the variable width and accept one argument in addition to the one to format.

Did PHPStan help you today? Did it make you happy in any way?

No response

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src#2543

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants