There seems to be quite a lot of static code analysis tools for PHP, could you please suggest the one, which can detect exceptions, which are thrown in the PHP code, but are never caught? (the ones, which can theoretically stop the execution on the PHP script).
I would be happy enough to see only stuff like throw new SomeException(), where SomeException extends Exception.
I am not looking for something too sophisticated – just to warn me that if I run someFunctionThatCanThrow (’cause there is throw statement inside) from index.php (you get the point), I can get in trouble. Even if in the runtime that would never happen.
Thanks.
PHPLint seems to be the answer. For example, it parses
, which will never throw an exception (unless you’re in the past), into:
So that’s exactly what I was asking for 🙂 Adding a docblock and catching the exception results in no more errors or warnings from PHPLint.