-
-
Notifications
You must be signed in to change notification settings - Fork 884
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
Substracted type must be rendered in parenthesis if not simple #10227
Comments
I agree it looks weird without parens, but it really depends on the grammar definition of the type syntax. Does I ran a quick test but it seems phpdoc parser does not accept |
The answer is no, type like |
@mvorisek After the latest push in 2.0.x, PHPStan now reports different result with your code snippet: @@ @@
-8: Dumped type: mixed~0|0.0|''|'0'|array{}|false|null
+PHP 8.0 – 8.3 (1 error)
+==========
+
+8: Dumped type: mixed~0|0.0|''|'0'|array{}|false|null
+
+PHP 7.2 – 7.4 (3 errors)
+==========
+
+5: Parameter $arr of method HelloWorld::test() has invalid type mixed.
+7: Variable $arr in empty() always exists and is not falsy.
+8: Dumped type: mixed Full reportPHP 8.0 – 8.3 (1 error)
PHP 7.2 – 7.4 (3 errors)
|
Implemented phpstan/phpstan-src#3360 |
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
Currently, the rendered type is wrong.
Code snippet that reproduces the problem
https://phpstan.org/r/1f20a038-6db0-4183-ad08-65e07202da24
Expected output
The text was updated successfully, but these errors were encountered: