Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1

(^198) CHAPTER 13 ■ SPL EXCEPTIONS


Just the Facts


This chapter covered the following SPL exceptions:


  • LogicException handles exceptions that are detectable at compile time—when the
    application is programmed incorrectly.

  • RuntimeException handles exceptions that can be detected only at runtime.

  • BadFunctionCallException handles exceptions due to illegal function calls.

  • BadMethodCallException handles exceptions due to illegal method calls.

  • DomainException handles domain exceptions. A domain is the set of all input values that
    are valid for a function.

  • RangeException handles range exceptions. A range is the set of all output values that are
    valid for a function.

  • InvalidArgumentException handles cases where a function or method receives an
    invalid argument.

  • LengthException handles exceptions due to length, such as too many elements in an array.

  • OverflowException handles exceptions due to overflow conditions—arithmetical overflow
    or overflow in the storage location.

  • UnderflowException handles exceptions due to a value being too small to maintain
    precision, resulting in loss of accuracy. In PHP, this can occur when using floats.


McArthur_819-9C13.fm Page 198 Thursday, February 28, 2008 7:53 AM

Free download pdf