Passed
Push — develop ( a2e445...3f2ff8 )
by nguereza
11:57
created
src/Calculator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 }
101 101
                 $stack[] = new Token(Token::LITERAL, $value, $variable);
102 102
             } elseif (Token::FUNCTION === $token->getType()) {
103
-                if (! array_key_exists($token->getValue(), $this->functions)) {
103
+                if (!array_key_exists($token->getValue(), $this->functions)) {
104 104
                     throw new UnknownFunctionException(sprintf(
105 105
                         'Unknown function [%s]',
106 106
                         $token->getValue()
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                     $token->getParamCount()
112 112
                 );
113 113
             } elseif (Token::OPERATOR === $token->getType()) {
114
-                if (! array_key_exists($token->getValue(), $this->operators)) {
114
+                if (!array_key_exists($token->getValue(), $this->operators)) {
115 115
                     throw new UnknownOperatorException(sprintf(
116 116
                         'Unknown operator [%s]',
117 117
                         $token->getValue()
Please login to merge, or discard this patch.
src/Executor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function getVariable(string $name): mixed
180 180
     {
181
-        if (! array_key_exists($name, $this->variables)) {
181
+        if (!array_key_exists($name, $this->variables)) {
182 182
             if ($this->variableNotFoundHandler !== null) {
183 183
                 return call_user_func($this->variableNotFoundHandler, $name);
184 184
             }
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             'uNeg' => [static fn($a) => 0 - $a, 200, false],
378 378
             '*' => [static fn($a, $b) => $a * $b, 180, false],
379 379
             '/' => [
380
-                static function ($a, $b) {
380
+                static function($a, $b) {
381 381
                     if ($b == 0) {
382 382
                         throw new DivisionByZeroException();
383 383
                     }
@@ -407,14 +407,14 @@  discard block
 block discarded – undo
407 407
     protected function defaultFunctions(): array
408 408
     {
409 409
         return [
410
-            'abs' => static function ($arg) {
410
+            'abs' => static function($arg) {
411 411
                 if ((int) $arg == $arg) {
412 412
                     return abs(intval($arg));
413 413
                 }
414 414
                 return abs(floatval($arg));
415 415
             },
416 416
             'array' => static fn(...$args) => $args,
417
-            'avg' => static function ($arg1, ...$args) {
417
+            'avg' => static function($arg1, ...$args) {
418 418
                 if (is_array($arg1)) {
419 419
                     if (count($arg1) === 0) {
420 420
                         throw new InvalidArgumentException('Array must contains at least one element');
@@ -426,13 +426,13 @@  discard block
 block discarded – undo
426 426
                 $args = [$arg1, ...array_values($args)];
427 427
                 return array_sum($args) / count($args);
428 428
             },
429
-            'ceil' => static function ($arg) {
429
+            'ceil' => static function($arg) {
430 430
                 if ((int) $arg == $arg) {
431 431
                     return ceil(intval($arg));
432 432
                 }
433 433
                 return ceil(floatval($arg));
434 434
             },
435
-            'floor' => static function ($arg) {
435
+            'floor' => static function($arg) {
436 436
                 if ((int) $arg == $arg) {
437 437
                     return floor(intval($arg));
438 438
                 }
@@ -448,22 +448,22 @@  discard block
 block discarded – undo
448 448
             'sqrt' => static fn($arg) => sqrt(floatval($arg)),
449 449
             'hypot' => static fn($arg1, $arg2) => hypot(floatval($arg1), floatval($arg2)),
450 450
             'intdiv' => static fn($arg1, $arg2) => intdiv(intval($arg1), intval($arg2)),
451
-            'max' => static function ($arg1, ...$args) {
451
+            'max' => static function($arg1, ...$args) {
452 452
                 if (is_array($arg1) && count($arg1) === 0) {
453 453
                     throw new InvalidArgumentException('Array must contains at least one element');
454 454
                 }
455 455
 
456 456
                 return max(is_array($arg1) && count($arg1) > 0 ? $arg1 : [$arg1, ...array_values($args)]);
457 457
             },
458
-            'min' => static function ($arg1, ...$args) {
458
+            'min' => static function($arg1, ...$args) {
459 459
                 if (is_array($arg1) && count($arg1) === 0) {
460 460
                     throw new InvalidArgumentException('Array must contains at least one element');
461 461
                 }
462 462
 
463
-                return min(is_array($arg1) && count($arg1) > 0  ? $arg1 : [$arg1, ...array_values($args)]);
463
+                return min(is_array($arg1) && count($arg1) > 0 ? $arg1 : [$arg1, ...array_values($args)]);
464 464
             },
465 465
             'pow' => static fn($arg1, $arg2) => $arg1 ** $arg2,
466
-            'round' => static function ($arg, int $precision = 0) {
466
+            'round' => static function($arg, int $precision = 0) {
467 467
                 if ((int) $arg == $arg) {
468 468
                     return round(intval($arg), intval($precision));
469 469
                 }
Please login to merge, or discard this patch.