comments - Using DocBlocks on PHP, Should I use @throws when I do not handle errors with execpetion? -
i have class handling errors, , not using try-throw-catch mechanism.
when commenting code uses class, should use the @throws tag though not throwing anything?
edit (try make question more clear):
my question if @throws tags means error occure when using code , handling in way, or means error occure , handling using throw keyword specifically?
after reading the documentation, realize not spelled out.
the documentation on @throws suggests if throw keyword present @ inside block of code, should documented each type of exception thrown regardless of whether or not you're handling or not.
so if have
try { throw new exception(); } catch (exception $e) { // handled! } put @throws entry in docblock.
Comments
Post a Comment