How many times you throw exceptions in your code? and how many of them are repeating?
This library collects general use cases and provide nice ::assert API.
Use it, don't waste your development time for custom exceptions, use one of our exceptions classes.
Tired of writing is_array($value) || $value instanceof \Traversable
?
Use predefined assertions and save your time, like so:
use Exception\InvalidTypeException;
function thatCanCantBeViolated($arrayOrTraversable) {
InvalidTypeException::assertIsTraversable($arrayOrTraversable);
// do your regular work
}
composer require widmogrod/php-exceptions
This repository follows semantic versioning concept. If you want to contribute, just follow GitHub workflow and open a pull request.
Quality assurance is brought to you by PHPSpec
composer test