Skip to content

Asserting instance of first item popped from Queue<I> makes phpstan assume following popped items are of the same type #9682

@simPod

Description

@simPod

Bug report

There are two classes, A and B, implementing interface I.

I have a Queue<I>

When I pop an item from Queue and assert item is of type A, then phpstan thinks all following popped items are of type A. However following popped items can be of any type implementing I.

Code snippet that reproduces the problem

https://phpstan.org/r/839e5a0d-c9f3-4d3c-be83-a60a5641fd7b

Expected output

No errors

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