diff --git a/src/exceptions.php b/src/exceptions.php index c24a6cb..5363de6 100644 --- a/src/exceptions.php +++ b/src/exceptions.php @@ -7,28 +7,39 @@ use Exception; * Class exceptions: répertoire d'exceptions normalisées */ class exceptions { + const WORD = "la valeur#s"; + /** * indiquer qu'une valeur est invalide pour une raison générique */ - static function invalid_value($value, ?string $reason=null, string $name="value"): Exception { + static function invalid_value($value, ?string $reason=null): Exception { } /** * spécialisation de {@link self::invalid_value()} qui permet d'indiquer les * types attendus */ - static function invalid_type($value, $expectedTypes=null, string $name="value"): Exception { + static function invalid_type($value, $expectedTypes=null): Exception { + } + + static function invalid_format($value, ?string $reason=null): Exception { + } + + static function out_of_range($value, ?int $min=null, ?int $max=null, ?string $reason=null): Exception { + } + + static function null_value(?string $reason=null): Exception { } /** * indiquer qu'une valeur est manquante */ - static function missing_value(string $name="value"): Exception { + static function missing_value(?string $reason=null): Exception { } /** * indiquer qu'une valeur est en trop */ - static function unexpected_value($value, ?string $reason=null, string $name="value"): Exception { + static function unexpected_value($value, ?string $reason=null): Exception { } }