Skip to content

array_column results in non-empty value according to PHPStan #10367

@qvdhinsezo

Description

@qvdhinsezo

Bug report

In the code snippet you can see an array is passed to array_column where we return all values from array key 3..
Since the array passed skipped array key 3.. it will return an empty array

But according to PHPStan the value now cannot ever be empty at that point..

Code snippet that reproduces the problem

https://phpstan.org/r/afff98b8-49c9-4c60-a164-10ebf227123e

Expected output

It shouldn't give the error: Variable $freightNumbers in empty() always exists and is not falsy.

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