Skip to content

Printf with width format is not recognized #9674

@fmarchalemisys

Description

@fmarchalemisys

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions