5

In PhpStorm's settings in Editor/Inspections/PHP/PHPDoc/Missing @throw tag(s) there are two options which are selected by default:

  • Ignore Runtime Exceptions
  • Ignore Logic Exceptions

Missing throw tags

QUESTION: Why would I want to ignore these specific exceptions while creating DocBlock? I guess this needs to have a solid reason since these options are checked by default.

Logic Exceptions are exceptions like DomainException or InvalidArgumentException.
Runtime Exceptions are exceptions like RangeException or UnderflowException

Note: I'm using PhpStorm v8.0.3

Community
  • 1
  • 1
Tomasz Madeyski
  • 10,742
  • 3
  • 50
  • 62
  • 1
    I think it's because these exceptions are normally thrown by PHP built-in functions, not explicitly by your code. Since they can be thrown by any function, it would be unreasonable for every function to document that it can throw them. – Barmar Jul 01 '15 at 20:28
  • but is there something wrong in throwing for example ``InvalidArgumentException`` by myself? I do it quite often. I checked ``Symfony2`` code and they do it too – Tomasz Madeyski Jul 01 '15 at 20:51
  • Nothing wrong with it. All this option does is tell PhpStorm not to warn about all the functions that don't have `@throws InvalidArgumentException` in their documentation. – Barmar Jul 01 '15 at 20:54

0 Answers0