ajout check_null
This commit is contained in:
parent
7742c2d330
commit
1dca3e8bee
|
@ -44,6 +44,10 @@ class ValueException extends UserException {
|
||||||
return new static(self::message(null, $message, $kind, $prefix, " should not be null"));
|
return new static(self::message(null, $message, $kind, $prefix, " should not be null"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static final function check_null($value, ?string $kind=null, ?string $prefix=null, ?string $message=null): void {
|
||||||
|
if ($value === null) throw static::null($kind, $prefix, $message);
|
||||||
|
}
|
||||||
|
|
||||||
static final function invalid_kind($value=null, ?string $kind=null, ?string $prefix=null, ?string $message=null): self {
|
static final function invalid_kind($value=null, ?string $kind=null, ?string $prefix=null, ?string $message=null): self {
|
||||||
return new static(self::message($value, $message, $kind, $prefix, " is invalid"));
|
return new static(self::message($value, $message, $kind, $prefix, " is invalid"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue