modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2025-10-09 17:41:59 +04:00
parent baf041c450
commit e7112c24c6
6 changed files with 11 additions and 11 deletions

View File

@ -410,7 +410,7 @@ class app {
function fencedJoin(string $basedir, ?string ...$paths): string {
$path = path::reljoin($basedir, ...$paths);
if (!path::is_within($path, $basedir)) {
throw exceptions::invalid_type($path, $kind, "path");
throw exceptions::invalid_value($path, "path");
}
return $path;
}

View File

@ -37,7 +37,7 @@ class config {
} elseif ($ext === ".json") {
$config = new JsonConfig($file);
} else {
throw exceptions::invalid_type($file, $kind, "config file");
throw exceptions::invalid_value($file, "config file");
}
self::add($config);
}

View File

@ -198,11 +198,11 @@ class cv {
*
* lever une exception si $value n'est d'aucun de ces types
*/
static final function check_key($value, ?string $prefix=null, bool $throw_exception=true): array {
static final function check_key($value, ?string $kind=null, bool $throw_exception=true): array {
$index = is_int($value)? $value : null;
$key = is_string($value)? $value : null;
if ($index === null && $key === null && $throw_exception) {
throw exceptions::invalid_type($value, $kind, "key", $prefix);
throw exceptions::invalid_type($value, $kind, "key");
} else {
return [$index, $key];
}
@ -214,12 +214,12 @@ class cv {
*
* @throws ValueException si $value n'est d'aucun de ces types
*/
static final function check_bsa($value, ?string $prefix=null, bool $throw_exception=true): array {
static final function check_bsa($value, ?string $kind=null, bool $throwException=true): array {
$bool = is_bool($value)? $value : null;
$scalar = !is_bool($value) && is_scalar($value)? $value : null;
$array = is_array($value)? $value : null;
if ($bool === null && $scalar === null && $array === null && $throw_exception) {
throw exceptions::invalid_type($value, $kind, ["bool", "scalar", "array"], $prefix);
if ($bool === null && $scalar === null && $array === null && $throwException) {
throw exceptions::invalid_type($value, $kind, ["bool", "scalar", "array"]);
} else {
return [$bool, $scalar, $array];
}

View File

@ -8,7 +8,7 @@ abstract class _base extends _common {
if (is_array($sql)) {
$prefix = $sql[0] ?? null;
if ($prefix === null) {
throw exceptions::invalid_type($sql, "cette requête sql");
throw exceptions::invalid_value($sql, "cette requête sql");
} elseif (_create::isa($prefix)) {
$sql = _create::parse($sql, $bindings);
$meta = ["isa" => "create", "type" => "ddl"];
@ -28,7 +28,7 @@ abstract class _base extends _common {
$sql = _generic::parse($sql, $bindings);
$meta = ["isa" => "generic", "type" => null];
} else {
throw exceptions::invalid_type($sql, "cette requête sql");
throw exceptions::invalid_value($sql, "cette requête sql");
}
} else {
if (!is_string($sql)) $sql = strval($sql);

View File

@ -15,7 +15,7 @@ abstract class _messenger {
static function set_messenger_class(string $msg_class, ?array $params=null) {
if (!is_subclass_of($msg_class, IMessenger::class)) {
throw exceptions::invalid_type($msg_class, $kind, IMessenger::class);
throw exceptions::invalid_type($msg_class, "class", IMessenger::class);
}
static::set_messenger(new $msg_class($params));
}

View File

@ -438,7 +438,7 @@ class str {
} elseif (preg_match(self::CAMEL_PATTERN2, $camel, $ms, PREG_OFFSET_CAPTURE)) {
# préfixe en minuscule
} else {
throw exceptions::invalid_type($camel, $kind, "camel string");
throw exceptions::invalid_value($camel, "camel string");
}
$parts[] = strtolower($ms[1][0]);
$index = intval($ms[1][1]) + strlen($ms[1][0]);