Skip to content

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

Closed
mad-briller wants to merge 1 commit intophpstan:1.8.xfrom
mad-briller:add.array-function-stubs
Closed

Added stub files and tests for array_* functions.#1571
mad-briller wants to merge 1 commit intophpstan:1.8.xfrom
mad-briller:add.array-function-stubs

Conversation

@mad-briller
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

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 this pull request may close these issues.

Support more array_***() functions with callbacks

2 participants