PHPLintがその答えのようです。たとえば、解析します
<?php
function some()
{
if (time() == 123) {
throw new Exception("I can't happen");
}
}
some();
、(過去にいない限り)例外をスローすることはありません。
BEGIN parsing of test-cSdHoW
1: <?php
2:
3: function some()
4: {
5: if (time() == 123) {
6: throw new Exception("I can't happen");
throw new Exception("I can't happen");
\_ HERE
==== 6: notice: here generating exception(s) Exception
throw new Exception("I can't happen");
\_ HERE
==== 6: ERROR: exception(s) must be caught or declared to be thrown: Exception
7: }
8: }
9:
10: some();
==== 3: notice: guessed signature of the function `some()' as void()
some();
\_ HERE
==== 10: notice: here generating exception(s) Exception
some();
\_ HERE
==== 10: Warning: uncaught exception(s): Exception
END parsing of test-cSdHoW
==== ?: notice: unused package `dummy.php'
==== ?: notice: required module `standard'
Overall test results: 1 errors, 1 warnings.
だから、まさにそれが私が求めていたものです:) docblockを追加して例外をキャッチしても、PHPLintからのエラーや警告は発生しなくなります。