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/jsgettext.php | |
| parent | e9a61e2fbbd930eaa80d6a5f33420cedc59d748c (diff) | |
PHP8.1 fixes from Rector
Diffstat (limited to 'tools/inc/lib/jsgettext/jsgettext.php')
| -rw-r--r-- | tools/inc/lib/jsgettext/jsgettext.php | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/tools/inc/lib/jsgettext/jsgettext.php b/tools/inc/lib/jsgettext/jsgettext.php index 6c70f0b4..75ea6566 100644 --- a/tools/inc/lib/jsgettext/jsgettext.php +++ b/tools/inc/lib/jsgettext/jsgettext.php @@ -4,16 +4,12 @@ require_once 'PoeditParser.php'; function buildOptions($args) { - $options = array( - 'files' => array(), - '-o' => null, - '-k' => '_' - ); - $len = count($args); + $options = ['files' => [], '-o' => null, '-k' => '_']; + $len = is_countable($args) ? count($args) : 0; $i = 1; 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 { @@ -43,14 +39,14 @@ $poeditParser = new PoeditParser($options['-o']); $poeditParser->parse(); - $errors = array(); + $errors = []; foreach ($inputFiles as $f) { - if (!is_readable($f) || !preg_match('#\.js$#', $f)) { + if (!is_readable($f) || !preg_match('#\.js$#', (string) $f)) { $errors[] = ("$f is not a valid javascript file."); continue; } - $jsparser = new JSParser($f, explode(' ', $options['-k'])); + $jsparser = new JSParser($f, explode(' ', (string) $options['-k'])); $jsStrings = $jsparser->parse(); $poeditParser->merge($jsStrings); } |
