-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
Incorrect type inference from result of array_map #1652
Comments
That's unrelated to |
Yeah, |
@marcospassos PHPStan now reports different result with your code snippet: @@ @@
-20: Parameter #1 ...$bars of function bar expects array<int, Bar>, array<int, static(Foo)> given.
+10: Unsafe usage of new static().
+17: Function bar() has no return typehint specified.
+20: Parameter #1 ...$bars of function bar expects Bar, static(Foo) given. |
@JanTvrdik PHPStan now reports different result with your code snippet: @@ @@
+10: Unsafe usage of new static().
23: Strict comparison using === between static(Foo) and 0 will always evaluate to false.
24: Strict comparison using === between static(Foo) and 0 will always evaluate to false. Full report
|
@marcospassos After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-20: Parameter #1 ...$bars of function bar expects array<int, Bar>, array<int, static(Foo)> given.
+10: Unsafe usage of new static().
+17: Function bar() has no return typehint specified. Full report
|
@JanTvrdik After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-23: Strict comparison using === between static(Foo) and 0 will always evaluate to false.
-24: Strict comparison using === between static(Foo) and 0 will always evaluate to false.
+10: Unsafe usage of new static().
+23: Strict comparison using === between Foo and 0 will always evaluate to false.
+24: Strict comparison using === between Bar and 0 will always evaluate to false. Full report
|
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. |
Summary of a problem or a feature request
The type inference from the result of
array_map
seems wrong.Code snippet that reproduces the problem
https://phpstan.org/r/b8dbc80d-ded7-42e4-9ed5-db6d8d795eb0
Expected output
No error.
The text was updated successfully, but these errors were encountered: