dhii / exception-interface
Interfaces for most common exceptions
Installs: 31 578
Dependents: 15
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 2
Open Issues: 1
Requires
- php: ^5.3 | ^7.0
- dhii/stringable-interface: ^0.1
Requires (Dev)
- codeclimate/php-test-reporter: <=0.3.2
- dhii/php-cs-fixer-config: dev-php-5.3
- phpunit/phpunit: ^4.8
- ptrofimov/xpmock: ^1.1
This package is auto-updated.
Last update: 2024-10-07 05:32:16 UTC
README
Interfaces for most common exceptions.
Details
ThrowableInterface
- The base of all exception interfaces. Declares all the same methods asException
in a compatible way, and additionally extendsStringableInterface
.BadSubjectExceptionInterface
- Base interface for all exceptions that are related to some value being invalid, malformed, out of range, etc. Exposes that value viagetSubject()
.InvalidArgumentExceptionInterface
- Allows de-coupling from the vanillaInvalidArgumentException
, and makes it more useful besides signalling the problem type by exposing the argument viaBadSubjectExceptionInterface#getSubejct()
.ArgumentCodeAwareInterface
- Useful withInvalidArgumentExceptionInterface
for providing information about the source of the problematic argument.OutOfBoundsExceptionInterface
- Complementing the nativeOutOfBoundsException
, it occurs when a key is addressed in a set that does not have it, like accessing a non-existing array key. Exposes the bad key.OutOfRangeExceptionInterface
- Complementing the nativeOutOfRangeException
, it occurs when a value is valid but illegal, i.e. is outside of the allowed range, like when an integer that represents a colour and must be 0-255 has the value of 256. Exposes the bad value.RuntimeExceptionInterface
- A generic runtime problem.InternalExceptionInterface
- A problem that occurs in relation to the inner workings of the unit, and is not caused by the consumer. Guarantees to expose an inner exception.