Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
takaram opened this issue Feb 18, 2023 · 2 comments · Fixed by phpstan/phpstan-src#2244
Closed

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

takaram opened this issue Feb 18, 2023 · 2 comments · Fixed by phpstan/phpstan-src#2244
Labels
Milestone

Comments

@takaram
Copy link

takaram commented Feb 18, 2023

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!

@takaram
Copy link
Author

takaram commented Feb 21, 2023

Keys can be NeverType as well.
https://phpstan.org/r/b5acd9c1-1352-4fe0-8c20-7c0c8ed5b0d0

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants