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

Added stub files and tests for array_* functions. #1571

Closed

Conversation

mad-briller
Copy link
Contributor

@mad-briller mad-briller commented Jul 30, 2022

closes phpstan/phpstan#7707

functions stubbed:

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

whilst adding these, phpstan warned because i didn't add array iterable types for the returns so i've specified them in the stubs, however i noticed this return type extension plugin which seems to be overriding them anyway, if theres something i should do instead let me know

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
Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TK templates should have array-key bounds instead of mixed.

@mad-briller
Copy link
Contributor Author

i tried that but it seemed to break the templating by using array-key or even int|string and i couldn't quite figure out why

when using array-key it reverted to showing errors like this:

+30: Parameter #3 $data_comp_func of function array_diff_uassoc expects callable(mixed, mixed): int, Closure(string, string): int<-1, 1> given.

@ondrejmirtes
Copy link
Member

Please push the stubs with array-key and then try to figure out why these errors are reported by debugging the codebase :) Thanks.

@ondrejmirtes
Copy link
Member

Feel free to open a new PR if you decide to finish it, thank you :)

@spaze spaze mentioned this pull request Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants