-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
try/catch improvement idea #3617
Comments
Yeah, there's a milestone for issues like this: https://github.com/phpstan/phpstan/milestone/11 |
@gnutix PHPStan now reports different result with your code snippet: @@ @@
+PHP 8.0 (1 error)
+==========
+
+7: Parameter #1 $string of function strtolower expects string, int|string given.
+
+PHP 7.1 – 7.4 (1 error)
+==========
+
7: Parameter #1 $str of function strtolower expects string, int|string given. |
@gnutix PHPStan now reports different result with your code snippet: @@ @@
+PHP 8.0 (1 error)
+==========
+
+6: Parameter #1 $string of function strtolower expects string, int|string given.
+
+PHP 7.1 – 7.4 (1 error)
+==========
+
6: Parameter #1 $str of function strtolower expects string, int|string given. |
@gnutix After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-7: Parameter #1 $str of function strtolower expects string, int|string given.
+PHP 8.0 (1 error)
+==========
+
+7: Parameter #1 $string of function strtolower expects string, int given.
+
+PHP 7.1 – 7.4 (1 error)
+==========
+
+7: Parameter #1 $str of function strtolower expects string, int given. Full reportPHP 8.0 (1 error)
PHP 7.1 – 7.4 (1 error)
|
@gnutix After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-6: Parameter #1 $str of function strtolower expects string, int|string given.
+No errors |
Fixed by: phpstan/phpstan-src#481 |
Closes phpstan/phpstan#1597 Closes phpstan/phpstan#3617 Closes phpstan/phpstan#778 Closes phpstan/phpstan#2969 Closes phpstan/phpstan#3004 Closes phpstan/phpstan#3710 Closes phpstan/phpstan#3822 Closes phpstan/phpstan#505 Closes phpstan/phpstan#1670 Closes phpstan/phpstan#1219
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. |
Everything being inferred after the last possible piece of code that may throw an exception should not have an impact on the catch clause.
Examples :
Correct : https://phpstan.org/r/c33d8ed6-a27a-447c-b8ee-c4d842ee2354
Incorrect : https://phpstan.org/r/3cdc98ed-2e4f-4269-8197-bd1dfaa7ecd2
The text was updated successfully, but these errors were encountered: