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
Passing some combinations of union types to parameter types messes up the closure param type inference #5675
Comments
Hi, |
Same error with |
@canvural After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-23: Expected type Hello<string>, actual: Hello
+No errors |
@canvural After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-23: Expected type Hello<string>, actual: Hello
+No errors |
Hi @ondrejmirtes , This looks like it's fixed for both of my examples. Maybe because of phpstan/phpstan-src@a483c11 ? Can we close this? |
Weird, the bot commented on this in October already, not sure why :) Closing this, will add a regression test later. |
I think there was an issue with the bot at that time. It commented on multiple issues that they are resolved. |
Closes phpstan/phpstan#5893 Closes phpstan/phpstan#6070 Closes phpstan/phpstan#5869 Closes phpstan/phpstan#6212 Closes phpstan/phpstan#6262 Closes phpstan/phpstan#6266 Closes phpstan/phpstan#6023 Closes phpstan/phpstan#6108 Closes phpstan/phpstan#6020 Closes phpstan/phpstan#1746 Closes phpstan/phpstan#1516 Closes phpstan/phpstan#6174 Closes phpstan/phpstan#6112 Closes phpstan/phpstan#5749 Closes phpstan/phpstan#5969 Closes phpstan/phpstan#5295 Closes phpstan/phpstan#5675 Closes phpstan/phpstan#5369 Closes phpstan/phpstan#6699 Closes phpstan/phpstan#6505
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
Passing some combinations of union types seems to break the closure param type inference.
For example,
@param (\Closure(static<T>): void)|array<array-key, int> $column
or@param (\Closure(Hello<T>): void)|array<array-key, int> $column
works.But
* @param (\Closure(static<T>): void)|string|array<int, mixed> $column
or@param (\Closure(static<T>): void)|array<array-key, int>|Bar $column
does not work.Code snippet that reproduces the problem
https://phpstan.org/r/24e0e585-9288-4b2a-95e9-8317dfd53426
Expected output
No error
Did PHPStan help you today? Did it make you happy in any way?
The text was updated successfully, but these errors were encountered: