Open suehiro24 opened 1 year ago
@suehiro24 After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
@@ @@
17: Parameter $buz of closure expects string, string|null given.
-PHP 7.4 (3 errors)
+PHP 7.2 – 7.4 (3 errors)
==========
7: Promoted properties are supported only on PHP 8.0 and later.
17: Named arguments are supported only on PHP 8.0 and later.
-17: Parameter $buz of closure expects string, string|null given.
-
-PHP 7.2 – 7.3 (1 error)
-==========
-
-14: Syntax error, unexpected T_VARIABLE, expecting ')' on line 14
+17: Parameter $buz of closure expects string, string|null given.
@suehiro24 After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
@@ @@
No errors
-PHP 7.4 (2 errors)
+PHP 7.2 – 7.4 (2 errors)
==========
7: Promoted properties are supported only on PHP 8.0 and later.
-19: Named arguments are supported only on PHP 8.0 and later.
-
-PHP 7.2 – 7.3 (1 error)
-==========
-
-14: Syntax error, unexpected T_VARIABLE, expecting ')' on line 14
+19: Named arguments are supported only on PHP 8.0 and later.
Bug report
When casting an object with guaranteed non-null properties to an array, unpacking it, and passing it as arguments to a function, an error like the following occurs.
Code snippet that reproduces the problem
https://phpstan.org/r/6dccf8af-8bff-4139-8571-2d11d6e75684
No errors occur when non-null is guaranteed for elements of a cast array.
https://phpstan.org/r/29ceea2b-d167-4eb5-8a20-041c221f32a6
Expected output
No errors.
Did PHPStan help you today? Did it make you happy in any way?
Thanks to PHPStan, I can proceed with coding while minimizing my worries. I always appreciate it!