Passed
Push — develop ( 782f14...172205 )
by nguereza
01:54
created
src/Calculator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
                 }
115 115
                 $stack[] = new Token(Token::LITERAL, $value, $variable);
116 116
             } elseif (Token::FUNCTION === $token->getType()) {
117
-                if (! array_key_exists($token->getValue(), $this->functions)) {
117
+                if (!array_key_exists($token->getValue(), $this->functions)) {
118 118
                     throw new UnknownFunctionException(sprintf(
119 119
                         'Unknown function [%s]',
120 120
                         $token->getValue()
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 $stack[] = $this->functions[$token->getValue()]
124 124
                                         ->execute($stack, $token->getParamCount());
125 125
             } elseif (Token::OPERATOR === $token->getType()) {
126
-                if (! array_key_exists($token->getValue(), $this->operators)) {
126
+                if (!array_key_exists($token->getValue(), $this->operators)) {
127 127
                     throw new UnknownOperatorException(sprintf(
128 128
                         'Unknown operator [%s]',
129 129
                         $token->getValue()
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             }
134 134
         }
135 135
         $result = array_pop($stack);
136
-        if ($result === null || ! empty($stack)) {
136
+        if ($result === null || !empty($stack)) {
137 137
             throw new IncorrectExpressionException('Expression stack is not empty');
138 138
         }
139 139
 
Please login to merge, or discard this patch.
src/Tokenizer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@
 block discarded – undo
324 324
      */
325 325
     public function buildReversePolishNotation(): array
326 326
     {
327
-        $tokens  = [];
327
+        $tokens = [];
328 328
         /** @var SplStack<Token> $stack */
329 329
         $stack = new SplStack();
330 330
 
Please login to merge, or discard this patch.
src/Executor.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function getVariable(string $name)
176 176
     {
177
-        if (! array_key_exists($name, $this->variables)) {
177
+        if (!array_key_exists($name, $this->variables)) {
178 178
             if ($this->variableNotFoundHandler !== null) {
179 179
                 return call_user_func($this->variableNotFoundHandler, $name);
180 180
             }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
             'uNeg' => [static fn($a) => 0 - $a, 200, false],
374 374
             '*' => [static fn($a, $b) => $a * $b, 180, false],
375 375
             '/' => [
376
-                static function ($a, $b) {
376
+                static function($a, $b) {
377 377
                     if ($b == 0) {
378 378
                         throw new DivisionByZeroException();
379 379
                     }
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         return [
406 406
             'abs' => static fn($arg) => abs($arg),
407 407
             'array' => static fn(...$args) => $args,
408
-            'avg' => static function ($arg1, ...$args) {
408
+            'avg' => static function($arg1, ...$args) {
409 409
                 if (is_array($arg1)) {
410 410
                     if (count($arg1) === 0) {
411 411
                         throw new InvalidArgumentException('Array must contains at least one element');
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
             'sqrt' => static fn($arg) => sqrt(floatval($arg)),
430 430
             'hypot' => static fn($arg1, $arg2) => hypot(floatval($arg1), floatval($arg2)),
431 431
             'intdiv' => static fn($arg1, $arg2) => intdiv(intval($arg1), intval($arg2)),
432
-            'max' => static function ($arg1, ...$args) {
432
+            'max' => static function($arg1, ...$args) {
433 433
                 if (is_array($arg1) && count($arg1) === 0) {
434 434
                     throw new InvalidArgumentException('Array must contains at least one element');
435 435
                 }
436 436
 
437 437
                 return max(is_array($arg1) ? $arg1 : [$arg1, ...$args]);
438 438
             },
439
-            'min' => static function ($arg1, ...$args) {
439
+            'min' => static function($arg1, ...$args) {
440 440
                 if (is_array($arg1) && count($arg1) === 0) {
441 441
                     throw new InvalidArgumentException('Array must contains at least one element');
442 442
                 }
Please login to merge, or discard this patch.