Making PHPStan happy

This commit is contained in:
Pavel Shevaev 2023-08-16 14:11:49 +03:00
parent 6f64be06fe
commit 48bd9c700b
1 changed files with 8 additions and 8 deletions

View File

@ -79,7 +79,7 @@ class JSM
return $m; return $m;
} }
function _currentModule() function _currentModule() : JSM_Module
{ {
$m = end($this->cur_modules); $m = end($this->cur_modules);
if(!$m) if(!$m)
@ -87,7 +87,7 @@ class JSM
return $m; return $m;
} }
function getCurrentModule() function getCurrentModule() : JSM_Module
{ {
return $this->_currentModule(); return $this->_currentModule();
} }
@ -1100,7 +1100,6 @@ class JSM_Eval
else else
{ {
throw new Exception("Unknown func " . $func); throw new Exception("Unknown func " . $func);
return false;
} }
} }
} }
@ -1322,8 +1321,8 @@ class JSM_Expr
case ' ': case "\r": case "\t": case "\n" : break; case ' ': case "\r": case "\t": case "\n" : break;
case '(': $token = array(self::T_LParen, $c); $binary = false; break; case '(': $token = array(self::T_LParen, $c); $binary = false; break;
case ')': $token = array(self::T_RParen, $c); $binary = true; break; case ')': $token = array(self::T_RParen, $c); $binary = true; break;
case '+': $token = $this->_getFuncToken(($binary ? '+' : 'u+'), $c); $binary = false; break; case '+': $token = $this->_getFuncToken(($binary ? '+' : 'u+')); $binary = false; break;
case '-': $token = $this->_getFuncToken(($binary ? '-' : 'u-'), $c); $binary = false; break; case '-': $token = $this->_getFuncToken(($binary ? '-' : 'u-')); $binary = false; break;
default: default:
//try to peek the next symbol and check if such an operator exists //try to peek the next symbol and check if such an operator exists
@ -1378,7 +1377,7 @@ function jsm_lex($string, array $tokenMap)
{ {
foreach($tokenMap as $regex => $token) foreach($tokenMap as $regex => $token)
{ {
if(preg_match($regex, $string, $matches, null, $offset)) if(preg_match($regex, $string, $matches, 0, $offset))
{ {
$tokens[] = array( $tokens[] = array(
$token, // token ID (e.g. T_FIELD_SEPARATOR) $token, // token ID (e.g. T_FIELD_SEPARATOR)
@ -1751,10 +1750,11 @@ class JSM_ArgsParser
++$this->c; ++$this->c;
} }
$str_num = substr($this->in, $start, $this->c - $start);
if($is_float) if($is_float)
return 1*substr($this->in, $start, $this->c - $start); return floatval($str_num);
else else
return (int)(1*substr($this->in, $start, $this->c - $start)); return intval($str_num);
} }
private function _error($error) private function _error($error)