Skip to content

array_column() returns array{*NEVER*} instead of array{} #8917

@takaram

Description

@takaram

Bug report

Return type of array_column() may be reported to include never type.
Rows without the expected key are omitted in the result array.

array_column([[]], 'not_exist'); // returns [], but typed as array{*NEVER*}

Code snippet that reproduces the problem

https://phpstan.org/r/b6720366-c731-47de-b493-c6366a18ce57

Expected output

All assertType pass

Did PHPStan help you today? Did it make you happy in any way?

I recently started to use PHPStan on my job, and it helps me a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions