| @@ -302,9 +302,9 @@ | ||
| 302 | 302 | return $this->raise_error( 'illegal_character_underscore' ); |
| 303 | 303 | |
| 304 | 304 | // Are we putting an operator on the stack? |
| 305 | 305 | } elseif ( ( in_array( $op, $ops, true ) || $ex ) && $expecting_operator ) { |
| 306 | - // Are we expecting an operator but have a number/variable/function/opening parenthesis? | |
| 306 | + // Are we expecting an operator but have a number/variable/function/opening parethesis? | |
| 307 | 307 | if ( $ex ) { |
| 308 | 308 | // It's an implicit multiplication. |
| 309 | 309 | $op = '*'; |
| 310 | 310 | --$index; |
| @@ -310,9 +310,9 @@ | ||
| 310 | 310 | --$index; |
| 311 | 311 | } |
| 312 | 312 | // Heart of the algorithm: . |
| 313 | 313 | // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition |
| 314 | - while ( $stack->count > 0 && ( $o2 = $stack->last() ) && in_array( $o2, $ops, true ) && ( $ops_r[ $op ] ? $ops_p[ $op ] < $ops_p[ $o2 ] : $ops_p[ $op ] <= $ops_p[ $o2 ] ) ) { // @phpstan-ignore offsetAccess.notFound | |
| 314 | + while ( $stack->count > 0 && ( $o2 = $stack->last() ) && in_array( $o2, $ops, true ) && ( $ops_r[ $op ] ? $ops_p[ $op ] < $ops_p[ $o2 ] : $ops_p[ $op ] <= $ops_p[ $o2 ] ) ) { | |
| 315 | 315 | // Pop stuff off the stack into the output. |
| 316 | 316 | $output[] = $stack->pop(); |
| 317 | 317 | } |
| 318 | 318 | // Many thanks: https://en.wikipedia.org/wiki/Reverse_Polish_notation . |
| @@ -398,9 +398,9 @@ | ||
| 398 | 398 | $stack->push( '(' ); // That was easy. |
| 399 | 399 | ++$index; |
| 400 | 400 | |
| 401 | 401 | // Do we now have a function/variable/number? |
| 402 | - } elseif ( $ex && ! $expecting_operator ) { // @phpstan-ignore booleanNot.alwaysTrue | |
| 402 | + } elseif ( $ex && ! $expecting_operator ) { | |
| 403 | 403 | $expecting_operator = true; |
| 404 | 404 | $value = $match[1]; |
| 405 | 405 | // May be a function, or variable with implicit multiplication against parentheses... |
| 406 | 406 | if ( 1 === preg_match( '/^(' . self::$name_pattern . ')\($/', $value, $matches ) ) { |
| @@ -572,9 +572,9 @@ | ||
| 572 | 572 | $args[ $this->functions[ $function_name ]['args'][ $i ] ] = $arg; |
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | // Recursion. |
| 576 | - $stack->push( $this->pfx( $this->functions[ $function_name ]['func'], $args ) ); | |
| 576 | + $stack->push( $this->pfx( $this->functions[ $function_name ]['func'], $args ) ); // @phpstan-ignore argument.type | |
| 577 | 577 | } |
| 578 | 578 | } elseif ( in_array( $token, array( '+', '-', '*', '/', '^', '>', '<', '=', '%' ), true ) ) { |
| 579 | 579 | // If the token is a binary operator, pop two values off the stack, do the operation, and push the result back on. |
| 580 | 580 | $op2 = $stack->pop(); |
| @@ -962,9 +962,9 @@ | ||
| 962 | 962 | * @param array<int, double|int> ...$args Values for which the mode shall be calculated. |
| 963 | 963 | * @return double|int Mode of the passed arguments. |
| 964 | 964 | */ |
| 965 | 965 | public static function mode( ...$args ) /* : float|int */ { |
| 966 | - $values = array_count_values( $args ); // @phpstan-ignore argument.type, argument.type | |
| 966 | + $values = array_count_values( $args ); // @phpstan-ignore argument.type | |
| 967 | 967 | asort( $values ); |
| 968 | 968 | return array_key_last( $values ); // @phpstan-ignore return.type |
| 969 | 969 | } |
| 970 | 970 | |