Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Flag manipulation and array value substitution within a loop causes unintended type #12653

@abcang

Description

@abcang

Bug report

If I implement the code as reproduced, the string constant is converted to a type like literal-string&non-falsy-string.
I have found that hinting the bool type with @var for $found works as expected.

Code snippet that reproduces the problem

https://phpstan.org/r/e8216080-38be-4654-b09d-1ffda02e1f34

Expected output

I expect the type to be the same as the return type of the method in the reproduced code.

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
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions