@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * For the full copyright and license information, please view the LICENSE |
| 6 | 6 | * file that was distributed with this source code. |
| 7 | 7 | */ |
| 8 | -declare(strict_types=1); |
|
| 8 | +declare(strict_types = 1); |
|
| 9 | 9 | |
| 10 | 10 | namespace PhpYacc\Support; |
| 11 | 11 | use PhpYacc\Compress\Compress; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $indexedArray[] = [$item, $i++]; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - \usort($indexedArray, function (array $a, array $b) use ($cmp) { |
|
| 115 | + \usort($indexedArray, function(array $a, array $b) use ($cmp) { |
|
| 116 | 116 | $result = $cmp($a[0], $b[0]); |
| 117 | 117 | if ($result !== 0) { |
| 118 | 118 | return $result; |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | public function offsetGet($index) |
| 79 | 79 | { |
| 80 | 80 | if (!$this->offsetExists($index)) { |
| 81 | - throw new LogicException("Offset $index does not exist"); |
|
| 81 | + throw new LogicException("offset $index does not exist"); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | return $this->production->body[$index + $this->pos]; |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * For the full copyright and license information, please view the LICENSE |
| 6 | 6 | * file that was distributed with this source code. |
| 7 | 7 | */ |
| 8 | -declare(strict_types=1); |
|
| 8 | +declare(strict_types = 1); |
|
| 9 | 9 | |
| 10 | 10 | namespace PhpYacc\Lalr; |
| 11 | 11 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $tmpList = $this->sortList($tmpList, function (Lr1 $x, Lr1 $y) { |
|
| 179 | + $tmpList = $this->sortList($tmpList, function(Lr1 $x, Lr1 $y) { |
|
| 180 | 180 | $gx = $x->item[-1]->code; |
| 181 | 181 | $gy = $y->item[-1]->code; |
| 182 | 182 | if ($gx !== $gy) { |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | if (!$tdefact) { |
| 358 | 358 | $tdefact = -1; |
| 359 | 359 | |
| 360 | - Utils::stableSort($tmpr, function (Reduce $x, Reduce $y) { |
|
| 360 | + Utils::stableSort($tmpr, function(Reduce $x, Reduce $y) { |
|
| 361 | 361 | if ($x->number != $y->number) { |
| 362 | 362 | return $y->number - $x->number; |
| 363 | 363 | } |
@@ -381,11 +381,11 @@ discard block |
||
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | // Squeeze tmpr |
| 384 | - $tmpr = \array_filter($tmpr, function (Reduce $reduce) use ($tdefact) { |
|
| 384 | + $tmpr = \array_filter($tmpr, function(Reduce $reduce) use ($tdefact) { |
|
| 385 | 385 | return $reduce->number !== $tdefact; |
| 386 | 386 | }); |
| 387 | 387 | |
| 388 | - Utils::stableSort($tmpr, function (Reduce $x, Reduce $y) { |
|
| 388 | + Utils::stableSort($tmpr, function(Reduce $x, Reduce $y) { |
|
| 389 | 389 | if ($x->symbol !== $y->symbol) { |
| 390 | 390 | return $x->symbol->code - $y->symbol->code; |
| 391 | 391 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | // do not move initial state |
| 425 | 425 | $initState = \array_shift($this->states); |
| 426 | 426 | |
| 427 | - Utils::stableSort($this->states, function (State $p, State $q) { |
|
| 427 | + Utils::stableSort($this->states, function(State $p, State $q) { |
|
| 428 | 428 | $numReduces = count($p->reduce) - 1; // -1 for default action |
| 429 | 429 | $pt = $numReduces; |
| 430 | 430 | $pn = count($p->shifts) + $numReduces; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | class Compress |
| 20 | 20 | { |
| 21 | 21 | const UNEXPECTED = 32767; |
| 22 | - const DEFAULT = -32766; |
|
| 22 | + const default = -32766; |
|
| 23 | 23 | const VACANT = -32768; |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | if ($cTermAction[$i][$j] === $table[$this->context->oTermIndex[$j]]) { |
| 481 | 481 | $cTermAction[$i][$j] = self::VACANT; |
| 482 | 482 | } elseif ($cTermAction[$i][$j] === self::VACANT) { |
| 483 | - $cTermAction[$i][$j] = self::DEFAULT; |
|
| 483 | + $cTermAction[$i][$j] = self::default; |
|
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * For the full copyright and license information, please view the LICENSE |
| 6 | 6 | * file that was distributed with this source code. |
| 7 | 7 | */ |
| 8 | -declare(strict_types=1); |
|
| 8 | +declare(strict_types = 1); |
|
| 9 | 9 | |
| 10 | 10 | namespace PhpYacc\CodeGen; |
| 11 | 11 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | protected function skipIf(string $spec): bool |
| 282 | 282 | { |
| 283 | - [ $dump, $test ] = \explode(' ', $spec, 2); |
|
| 283 | + [$dump, $test] = \explode(' ', $spec, 2); |
|
| 284 | 284 | |
| 285 | 285 | $test = \trim($test); |
| 286 | 286 | switch ($test) { |
@@ -431,7 +431,7 @@ |
||
| 431 | 431 | case 'YYUNEXPECTED': |
| 432 | 432 | return \sprintf('%d', Compress::UNEXPECTED); |
| 433 | 433 | case 'YYDEFAULT': |
| 434 | - return \sprintf('%d', Compress::DEFAULT); |
|
| 434 | + return \sprintf('%d', Compress::default); |
|
| 435 | 435 | case 'YYMAXLEX': |
| 436 | 436 | return \sprintf('%d', \count($this->compress->yytranslate)); |
| 437 | 437 | case 'YYLAST': |