Skip to content

Validate Parameter to RecursiveIteratorIterator #10324

@oleibman

Description

@oleibman

Bug report

This was a fairly silly error on my part. RecursiveIteratorIterator takes 3 parameters. The second, when specified, must be one, or a combination, of 3 values; the third, when specified, can only take a single value. I supplied a value intended for the second parameter as the third parameter. This was syntactically correct, so Phpstan reports no errors. Realizing that this may be more trouble than it's worth, might it be able to detect the logical error?

Code snippet that reproduces the problem

https://phpstan.org/r/54bddb36-1744-4022-adca-dc076f223083

Expected output

Phpstan correctly reports no error, but, in an ideal world, it might detect that CHILD_FIRST is not valid for the third parameter, and similarly validate the second parameter.

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

Very pleased with the product.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions