-
Notifications
You must be signed in to change notification settings - Fork 504
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
Add generic typings to array_uintersect #3806
base: 2.1.x
Are you sure you want to change the base?
Conversation
This PR is a partial fix for phpstan/phpstan#7707, if this PR is the correct way to do this I can add support for the other functions mentioned as well |
a51ad7a
to
ba154ee
Compare
This pull request has been marked as ready for review. |
I see, I missed this when looking through issues. However there's a slight difference in that the arrays can be different per @ondrejmirtes' suggestion. The same issue with that PR is still present here; the definitions of these functions are wrong, but merging this would get us closer to PHPStan fully understanding these functions |
@axlon You're right. Feel free to take whatever you want from the original PR, if you decide to expand this one to cover all similar functions. Alternatively, I'm also around to update my PR if ondrejmirtes prefers that. |
I'll try to take a look at this soon |
I think I've found a way to document these functions where they're quite accurate (so far), but I hit a roadblock with array shapes; PHPStan seems to add an integer key to the return type whenever the first argument is an array shape. I've added failing tests in the last commit and I will try to figure out why this is happening |
@axlon It looks like it might be possible to work around it by using |
|
@ondrejmirtes please check this out when you find the time, and let me know if this is the way forward. If it is I'll work on adding the remaining array functions listed in the original issue. As far as the failing tests go:
|
This pull request has been marked as ready for review. |
This PR adds generic typings to
array_uintersect
, I copied the annotations fromarray_udiff