Skip to content

007 — Exceptions

  • Throw exceptions instead of returning an error code.
  • Exception class name must be suffixed with Exception.
  • Use grammatically correct error messages including ending punctuation, that's most exceptions must end with a period.
  • \InvalidArgumentException must be used directly. There should be no exceptions inherited from it.
  • \InvalidArgumentException must never be caught.

Referencias