diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2024-11-24 13:55:00 +0000 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2024-11-24 13:55:00 +0000 |
| commit | 53fee911e6a39a5c8504d03d1f114a131d00784c (patch) | |
| tree | b57ea5ecf13f9d8333a68cb6c7e7a4b5928d97b9 /classes/Config.php | |
| parent | 43e8864eada6a192732919ab1a96f8e0a672f6af (diff) | |
| parent | 9b0baf9b32a7f1c299c4bb2127dc192a7daa1ac9 (diff) | |
Merge branch 'feature/php8-match' into 'master'
Use match expressions in some places.
See merge request tt-rss/tt-rss!82
Diffstat (limited to 'classes/Config.php')
| -rw-r--r-- | classes/Config.php | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/classes/Config.php b/classes/Config.php index e269fde30..4775faf71 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -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 { |