Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix array_column() with explicit null $index_key #3970

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

Merged

Conversation

@herndlm
Copy link
Contributor

@herndlm herndlm commented Apr 29, 2025

Neirda24 reacted with heart emoji
@herndlm herndlm force-pushed the array-column-explicit-null-index-key branch 2 times, most recently from 179a727 to eab1722 Compare May 8, 2025 14:34
Copy link
Contributor Author

herndlm commented May 8, 2025
edited
Loading

hey @staabm, I only saw your refactor in #3785 now because of conflicts :) I think the $indexType should not be nullable to avoid confusion / inconsistency with null vs NullType.

I think your follow-up for the rules does not exist yet, does it? Would it work with a non-nullable indexType too? I did adapt the new helper here with the rebase to keep the fix for the linked issue simple.

@ondrejmirtes I avoid pinging you, but looks like this small fix is a blocker or has conflict potential for that new rule

Copy link
Contributor

staabm commented May 8, 2025

thanks for the ping

I think the $indexType should not be nullable to avoid confusion / inconsistency with null vs NullType.

IIRC its fine, as the rule - as I had it implemted previously in https://github.com/phpstan/phpstan-src/pull/3706/files - does not rely on the nullability of the parameter.

I will have a closer look when re-submitting the new rule

herndlm reacted with thumbs up emoji

@herndlm herndlm force-pushed the array-column-explicit-null-index-key branch from eab1722 to faa859e Compare May 14, 2025 08:21
Copy link
Contributor Author

herndlm commented May 16, 2025

jfyi, this is an easy one I think and done already for a while

@ondrejmirtes ondrejmirtes merged commit 4d58c28 into phpstan:2.1.x May 16, 2025
415 of 417 checks passed
Copy link
Member

Thank you!

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

array_column with null as index key should be a list

AltStyle によって変換されたページ (->オリジナル) /