diff options
| author | wn <4-wn@users.noreply.gitlab.tt-rss.org> | 2025-04-30 16:34:52 +0000 |
|---|---|---|
| committer | wn <4-wn@users.noreply.gitlab.tt-rss.org> | 2025-04-30 16:34:52 +0000 |
| commit | 4ae17d0f1c956bfe392653ab847eb2e3da6f7bfc (patch) | |
| tree | bfecf40fe1a3e7d86d71e367e05d85b4e9e8bf00 /include/functions.php | |
| parent | 4cb8a84df46d46bc325b6638defbdc4dc34151ed (diff) | |
| parent | f097c5ed97671f66be71e52c13917c23528ba308 (diff) | |
Merge branch 'feature/phpstan-updates' into 'master'
PHPStan update and addressing findings
See merge request tt-rss/tt-rss!122
Diffstat (limited to 'include/functions.php')
| -rw-r--r-- | include/functions.php | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/include/functions.php b/include/functions.php index 69e5e746e..c573042a2 100644 --- a/include/functions.php +++ b/include/functions.php @@ -112,24 +112,21 @@ // create a list like "en" => 0.8 $langs = array_combine($lang_parse[1], $lang_parse[4]); - /** @phpstan-ignore function.alreadyNarrowedType (PHP 7.4 will return false if array_value has an issue) */ - if (is_array($langs)) { - // set default to 1 for any without q factor - foreach ($langs as $lang => $val) { - if ($val === '') $langs[$lang] = 1; - } + // set default to 1 for any without q factor + foreach ($langs as $lang => $val) { + if ($val === '') $langs[$lang] = 1; + } - // sort list based on value - arsort($langs, SORT_NUMERIC); + // sort list based on value + arsort($langs, SORT_NUMERIC); - foreach (array_keys($langs) as $lang) { - $lang = strtolower($lang); + foreach (array_keys($langs) as $lang) { + $lang = strtolower($lang); - foreach ($valid_langs as $vlang => $vlocale) { - if ($vlang == $lang) { - $selected_locale = $vlocale; - break 2; - } + foreach ($valid_langs as $vlang => $vlocale) { + if ($vlang == $lang) { + $selected_locale = $vlocale; + break 2; } } } |