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 function stubs #2836

Closed
wants to merge 2 commits into from
Closed

Array function stubs #2836

wants to merge 2 commits into from

Conversation

spaze
Copy link
Contributor

@spaze spaze commented Dec 18, 2023

No description provided.

mad-briller and others added 2 commits December 19, 2023 00:24
array_diff_uassoc
array_diff_ukey
array_intersect_uassoc
array_intersect_ukey
array_udiff_assoc
array_udiff_uassoc
array_uintersect_assoc
array_uintersect_uassoc
array_uintersect
@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.

@spaze spaze changed the base branch from 1.11.x to 1.10.x December 18, 2023 23:32
@spaze spaze changed the base branch from 1.10.x to 1.11.x December 18, 2023 23:34
@spaze
Copy link
Contributor Author

spaze commented Dec 19, 2023

This was a test to see if @mad-briller's #1571 would still misbehave (say callable(mixed, mixed) instead of callable(string, string) in the error message) with current PHPStan, and unfortunately I have to report that it sill does. From the test *uassoc results:

-31: Parameter #4 $key_compare_func of function array_uintersect_uassoc expects callable(string, string): int<-1, 1>, Closure(int, int): int<-1, 1> given.
+31: Parameter #4 $key_compare_func of function array_uintersect_uassoc expects callable(mixed, mixed): int, Closure(int, int): int<-1, 1> given.

When there's no key compare function, array-key is fine, and you only get string literals now, which is unrelated to this change in this PR:

-22: Parameter #3 $data_compare_func of function array_uintersect expects callable(string, string): int<-1, 1>, Closure(int, int): int<-1, 1> given.
+22: Parameter #3 $data_compare_func of function array_uintersect expects callable('a'|'b'|'c'|'d', 'a'|'b'|'c'|'d'): int<-1, 1>, Closure(int, int): int<-1, 1> given.

Tried checking existing stubs, but this seems beyond my knowledge right now, don't even know where to begin :(

@spaze spaze closed this Dec 19, 2023
@spaze spaze deleted the spaze/add.array-function-stubs branch December 19, 2023 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants