🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

incorrect type or value inference when using non strict in_array() in conditionnal #14878

Description

@xamtheone

Bug report

In this example on level 4, phpstan seems to assume that $b cannot be true if we reach the elseif, however if I set the strict parameter of in_array to true, or if i replace the in_array comparison with $a == 1 for example, this doesn't happen. If I typehint parameter $a as int, it also doesn't happen.

Code snippet that reproduces the problem

https://phpstan.org/r/caa93f12-eb6f-4af4-8426-f95a9e636f2a

Expected output

No warnings should appear for level 4 and 5 with this example, without adding types.

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