Skip to content

array_column with null as index key should be a list #12945

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

Open
Neirda24 opened this issue Apr 28, 2025 · 1 comment · May be fixed by phpstan/phpstan-src#3970
Open

array_column with null as index key should be a list #12945

Neirda24 opened this issue Apr 28, 2025 · 1 comment · May be fixed by phpstan/phpstan-src#3970

Comments

@Neirda24
Copy link

See this snippet :

https://phpstan.org/r/22d5c620-be98-4970-af82-b8d25d04822b

array_column with null indexing does not seem to be reported as list.

Am I missing something ?

@herndlm
Copy link
Contributor

herndlm commented Apr 29, 2025

The return type extension does not handle explicit NullType and implicit null` the same. See https://github.com/phpstan/phpstan-src/blob/2.1.13/src/Type/Php/ArrayColumnFunctionReturnTypeExtension.php#L45

But that should be an easy fix, I'll open a PR.

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

Successfully merging a pull request may close this issue.

2 participants