modifs.mineures sans commentaires
This commit is contained in:
parent
e9b58d801e
commit
1dfda3df07
34
src/exceptions.php
Normal file
34
src/exceptions.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace nulib;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class exceptions: répertoire d'exceptions normalisées
|
||||
*/
|
||||
class exceptions {
|
||||
/**
|
||||
* indiquer qu'une valeur est invalide pour une raison générique
|
||||
*/
|
||||
static function invalid_value($value, ?string $reason=null, string $name="value"): 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 {
|
||||
}
|
||||
|
||||
/**
|
||||
* indiquer qu'une valeur est manquante
|
||||
*/
|
||||
static function missing_value(string $name="value"): Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* indiquer qu'une valeur est en trop
|
||||
*/
|
||||
static function unexpected_value($value, ?string $reason=null, string $name="value"): Exception {
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user