Skip to content

Inconsistent behaviour of array_shift() return type #3548

@dktapps

Description

@dktapps

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/531108ab-4b3a-4354-bb59-36261cc64140

in phpstan 0.12.31, this odd behaviour... I don't understand why it works when returning directly vs assigning to a variable.

Expected output

Neither case should report an error because the array is definitely non-empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions