diff options
| author | Appleman1234 <applemansigloo@gmail.com> | 2022-09-25 13:30:13 +1000 |
|---|---|---|
| committer | Appleman1234 <applemansigloo@gmail.com> | 2022-09-25 13:30:13 +1000 |
| commit | 2c69095a1edf7474073451285238659d0f62ce3f (patch) | |
| tree | 5dee476605402c66dc2853d0836b29f6aedae62b /tools/inc/lib/jsgettext/po2json.php | |
| parent | e9a61e2fbbd930eaa80d6a5f33420cedc59d748c (diff) | |
PHP8.1 fixes from Rector
Diffstat (limited to 'tools/inc/lib/jsgettext/po2json.php')
| -rw-r--r-- | tools/inc/lib/jsgettext/po2json.php | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tools/inc/lib/jsgettext/po2json.php b/tools/inc/lib/jsgettext/po2json.php index 847b0899..8fb6f69f 100644 --- a/tools/inc/lib/jsgettext/po2json.php +++ b/tools/inc/lib/jsgettext/po2json.php @@ -3,16 +3,12 @@ require_once 'PoeditParser.php'; function buildOptions($args) { - $options = array( - '-o' => null, - '-i' => null, - '-n' => 'l10n' - ); - $len = count($args); + $options = ['-o' => null, '-i' => null, '-n' => 'l10n']; + $len = is_countable($args) ? count($args) : 0; $i = 0; while ($i < $len) { - if (preg_match('#^-[a-z]$#i', $args[$i])) { - $options[$args[$i]] = isset($args[$i+1]) ? trim($args[$i+1]) : true; + if (preg_match('#^-[a-z]$#i', (string) $args[$i])) { + $options[$args[$i]] = isset($args[$i+1]) ? trim((string) $args[$i+1]) : true; $i += 2; } else { @@ -33,8 +29,8 @@ $poeditParser->parse(); if ($poeditParser->toJSON($options['-o'], $options['-n'])) { - $strings = count($poeditParser->getStrings()); - echo "Successfully exported " . count($strings) . " strings.\n"; + $strings = is_countable($poeditParser->getStrings()) ? count($poeditParser->getStrings()) : 0; + echo "Successfully exported " . (is_countable($strings) ? count($strings) : 0) . " strings.\n"; } else { echo "Cannor write to file '{$options['-o']}'.\n"; |
