Use match expressions in some places.

This commit is contained in:
wn_
2024-11-23 19:18:52 +00:00
parent 43e8864ead
commit 9b0baf9b32
9 changed files with 73 additions and 140 deletions

View File

@@ -424,14 +424,11 @@ class Config {
}
static function cast_to(string $value, int $type_hint): bool|int|string {
switch ($type_hint) {
case self::T_BOOL:
return sql_bool_to_bool($value);
case self::T_INT:
return (int) $value;
default:
return $value;
}
return match ($type_hint) {
self::T_BOOL => sql_bool_to_bool($value),
self::T_INT => (int) $value,
default => $value,
};
}
private function _get(string $param): bool|int|string {