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 does not respect non-emptyness #3799

Closed
vudaltsov opened this issue Jul 10, 2020 · 2 comments · Fixed by #3813
Closed

array_column does not respect non-emptyness #3799

vudaltsov opened this issue Jul 10, 2020 · 2 comments · Fixed by #3813

Comments

@vudaltsov
Copy link
Contributor

https://psalm.dev/r/9f82a17eec

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/9f82a17eec
<?php

/** @psalm-var non-empty-list<array{string}> $nonEmptyList */

$col = array_column($nonEmptyList, 0);

/** @psalm-trace $col */
Psalm output (using commit d8eca89):

INFO: Trace - 7:25 - $col: list<string>

INFO: UnusedVariable - 5:1 - Variable $col is never referenced

@muglug
Copy link
Collaborator

muglug commented Jul 10, 2020

Feel free to PR a change to ArrayColumnReturnTypeProvider – should be a relatively easy alteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants