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
Improve constant array as callable with unions of constant strings #2343
Comments
Here is a more simple case using |
@marc-mabe This is a separate issue, please open a new issue for that. Thanks. |
@ondrejmirtes ok I did here #2846 |
@ondrejmirtes PHPStan now reports different result with your code snippet: @@ @@
+PHP 8.0 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return typehint specified.
+10: Method Sample\A::bye() has no return typehint specified.
+14: Method Sample\A::all() has no return typehint specified.
+23: Parameter #1 $callback of function call_user_func expects callable(): mixed, array('Sample\\A', 'bye'|'say') given.
+
+PHP 7.1 – 7.4 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return typehint specified.
+10: Method Sample\A::bye() has no return typehint specified.
+14: Method Sample\A::all() has no return typehint specified.
23: Parameter #1 $function of function call_user_func expects callable(): mixed, array('Sample\\A', 'bye'|'say') given. Full reportPHP 8.0 (4 errors)
PHP 7.1 – 7.4 (4 errors)
|
@marc-mabe PHPStan now reports different result with your code snippet: @@ @@
-6: Parameter #1 $function of function call_user_func expects callable(): mixed, array(class-string<static(Test)>, 'staticFunc') given.
+No errors |
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
+PHP 8.0 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return type specified.
+10: Method Sample\A::bye() has no return type specified.
+14: Method Sample\A::all() has no return type specified.
+23: Parameter #1 $callback of function call_user_func expects callable(): mixed, array('Sample\\A', 'bye'|'say') given.
+
+PHP 7.1 – 7.4 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return type specified.
+10: Method Sample\A::bye() has no return type specified.
+14: Method Sample\A::all() has no return type specified.
23: Parameter #1 $function of function call_user_func expects callable(): mixed, array('Sample\\A', 'bye'|'say') given. Full reportPHP 8.0 (4 errors)
PHP 7.1 – 7.4 (4 errors)
|
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-23: Parameter #1 $function of function call_user_func expects callable(): mixed, array('Sample\\A', 'bye'|'say') given.
+PHP 8.0 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return type specified.
+10: Method Sample\A::bye() has no return type specified.
+14: Method Sample\A::all() has no return type specified.
+23: Parameter #1 $callback of function call_user_func expects callable(): mixed, array{'Sample\\A', 'bye'|'say'} given.
+
+PHP 7.1 – 7.4 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return type specified.
+10: Method Sample\A::bye() has no return type specified.
+14: Method Sample\A::all() has no return type specified.
+23: Parameter #1 $function of function call_user_func expects callable(): mixed, array{'Sample\\A', 'bye'|'say'} given. Full reportPHP 8.0 (4 errors)
PHP 7.1 – 7.4 (4 errors)
|
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-23: Parameter #1 $function of function call_user_func expects callable(): mixed, array('Sample\\A', 'bye'|'say') given.
+PHP 8.0 – 8.1 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return type specified.
+10: Method Sample\A::bye() has no return type specified.
+14: Method Sample\A::all() has no return type specified.
+23: Parameter #1 $callback of function call_user_func expects callable(): mixed, array{'Sample\\A', 'bye'|'say'} given.
+
+PHP 7.1 – 7.4 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return type specified.
+10: Method Sample\A::bye() has no return type specified.
+14: Method Sample\A::all() has no return type specified.
+23: Parameter #1 $function of function call_user_func expects callable(): mixed, array{'Sample\\A', 'bye'|'say'} given. Full reportPHP 8.0 – 8.1 (4 errors)
PHP 7.1 – 7.4 (4 errors)
|
@ondrejmirtes After the latest push in 1.8.x, PHPStan now reports different result with your code snippet: @@ @@
-23: Parameter #1 $function of function call_user_func expects callable(): mixed, array('Sample\\A', 'bye'|'say') given.
+PHP 8.0 – 8.2 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return type specified.
+10: Method Sample\A::bye() has no return type specified.
+14: Method Sample\A::all() has no return type specified.
+23: Parameter #1 $callback of function call_user_func expects callable(): mixed, array{'Sample\\A', 'bye'|'say'} given.
+
+PHP 7.1 – 7.4 (4 errors)
+==========
+
+ 6: Method Sample\A::say() has no return type specified.
+10: Method Sample\A::bye() has no return type specified.
+14: Method Sample\A::all() has no return type specified.
+23: Parameter #1 $function of function call_user_func expects callable(): mixed, array{'Sample\\A', 'bye'|'say'} given. Full reportPHP 8.0 – 8.2 (4 errors)
PHP 7.1 – 7.4 (4 errors)
|
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
Code snippet that reproduces the problem
https://phpstan.org/r/34956aa9-a75c-42f8-a12f-67d1625cb327
Expected output
No errors
The text was updated successfully, but these errors were encountered: