-
-
Notifications
You must be signed in to change notification settings - Fork 862
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
Unset detection with try/catch does not take into account origin of the exception. #3822
Comments
This is very similar to other issues grouped in this milestone: https://github.com/phpstan/phpstan/milestone/11 |
@frankdejonge PHPStan now reports different result with your code snippet: @@ @@
+PHP 7.3 – 8.0 (1 error)
+==========
+
+31: Variable $body might not be defined.
+
+PHP 7.1 – 7.2 (2 errors)
+==========
+
+30: Caught class JsonException not found.
31: Variable $body might not be defined. Full reportPHP 7.3 – 8.0 (1 error)
PHP 7.1 – 7.2 (2 errors)
|
@frankdejonge After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-31: Variable $body might not be defined.
+PHP 7.3 – 8.0
+==========
+
+No errors
+
+PHP 7.1 – 7.2 (1 error)
+==========
+
+30: Caught class JsonException not found. Full reportPHP 7.3 – 8.0No errors PHP 7.1 – 7.2 (1 error)
|
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. |
Bug report
When an
unset
call is placed after a call where an exception can originate from, the catch clause is not able to use the variable, even though theunset call
can never be made.Code snippet that reproduces the problem
https://phpstan.org/r/abf2e5c9-90a3-40fc-9979-6d19255e7c67
Expected output
No errors were found
The text was updated successfully, but these errors were encountered: