Unable to get PHPStan to warn about missing try/catch blocks #10944
-
Hi, I'm unable to get PHPStan 1.10.67 to fail when function calls, which throws checked exceptions, are not wrapped in try/catch blocks. Here is my test code:
I use the following configuration (~/phpstan.neon):
I'm testing using the following code (~/Server/TestPhpStan.php):
I run PHPStan on the command line from the root of my project where phpstan.neon is located:
The output result: Version check PHP version (
Can someone point me in the right direction here? What am I missing? -- Thanks a lot :-) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
You mean to get an error for I recommend you to wrap all your code in functions and classes. |
Beta Was this translation helpful? Give feedback.
You mean to get an error for
echo multiplyByTwo(4);
when called outside of any function or method? There currently isn't any rule for that in PHPStan.I recommend you to wrap all your code in functions and classes.