Skip to content

Not direct condition doesn't change variable type #3986

@snapshotpl

Description

@snapshotpl

Bug report

If I check variable type in if statement directly type is infern correct, but when do it early and assign result to variable and check it late, then type is wrong.

Code snippet that reproduces the problem

https://phpstan.org/r/c9d5a01d-59f6-46b9-826c-6159e5a4ece3

Expected output

No error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions