@@ -73,7 +73,7 @@ |
||
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @param CompressResult $result |
| 76 | - * @param $resultFile |
|
| 76 | + * @param resource $resultFile |
|
| 77 | 77 | * @param null $headerFile |
| 78 | 78 | * |
| 79 | 79 | * @throws LogicException |
@@ -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': |
@@ -284,7 +284,7 @@ |
||
| 284 | 284 | */ |
| 285 | 285 | protected function skipIf(string $spec): bool |
| 286 | 286 | { |
| 287 | - [ $dump, $test ] = \explode(' ', $spec, 2); |
|
| 287 | + [$dump, $test] = \explode(' ', $spec, 2); |
|
| 288 | 288 | |
| 289 | 289 | $test = \trim($test); |
| 290 | 290 | switch ($test) { |
@@ -219,7 +219,7 @@ |
||
| 219 | 219 | * Context constructor. |
| 220 | 220 | * |
| 221 | 221 | * @param string $filename |
| 222 | - * @param resource|null $debugFile |
|
| 222 | + * @param null|resource $debugFile |
|
| 223 | 223 | */ |
| 224 | 224 | public function __construct(string $filename = 'YY', resource $debugFile = null) |
| 225 | 225 | { |
@@ -317,7 +317,7 @@ |
||
| 317 | 317 | $nil->code = $code++; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - \usort($this->_symbols, function ($a, $b) { |
|
| 320 | + \usort($this->_symbols, function($a, $b) { |
|
| 321 | 321 | return $a->code <=> $b->code; |
| 322 | 322 | }); |
| 323 | 323 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @param int $terminal |
| 80 | 80 | * @param int $precedence |
| 81 | 81 | * @param int $associativity |
| 82 | - * @param Symbol|null $type |
|
| 82 | + * @param null|\self $type |
|
| 83 | 83 | * |
| 84 | 84 | * @throws LogicException |
| 85 | 85 | */ |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | - * @param Symbol|null $type |
|
| 177 | + * @param null|\self $type |
|
| 178 | 178 | */ |
| 179 | 179 | public function setType(self $type = null) |
| 180 | 180 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * Conflict constructor. |
| 31 | 31 | * |
| 32 | 32 | * @param Symbol $symbol |
| 33 | - * @param Conflict|null $next |
|
| 33 | + * @param null|\self $next |
|
| 34 | 34 | */ |
| 35 | 35 | protected function __construct(Symbol $symbol, self $next = null) |
| 36 | 36 | { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | - * @param Conflict|null $next |
|
| 74 | + * @param null|\self $next |
|
| 75 | 75 | */ |
| 76 | 76 | public function setNext(self $next = null) |
| 77 | 77 | { |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | /** |
| 97 | 97 | * @param array $symbols |
| 98 | 98 | * @param int $n |
| 99 | - * @param $delm |
|
| 99 | + * @param string $delm |
|
| 100 | 100 | * @param array $attribute |
| 101 | 101 | * |
| 102 | 102 | * @throws ParseException |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | |
| 125 | 125 | $expanded = $this->macros->apply($this->context, $symbols, $tokens, $n, $attribute); |
| 126 | 126 | |
| 127 | - $action = \implode('', \array_map(function (Token $token) { |
|
| 127 | + $action = \implode('', \array_map(function(Token $token) { |
|
| 128 | 128 | return $token->getValue(); |
| 129 | 129 | }, $expanded)); |
| 130 | 130 | |
@@ -564,8 +564,8 @@ discard block |
||
| 564 | 564 | /** @var Symbol $left */ |
| 565 | 565 | $left = $gram->body[0]; |
| 566 | 566 | $right = $gram->body[1] ?? null; |
| 567 | - if (($right === null || ($right->associativity & Production::EMPTY)) && !($left->associativity & Production::EMPTY)) { |
|
| 568 | - $left->setAssociativityFlag(Production::EMPTY); |
|
| 567 | + if (($right === null || ($right->associativity & Production::empty)) && !($left->associativity & Production::empty)) { |
|
| 568 | + $left->setAssociativityFlag(Production::empty); |
|
| 569 | 569 | $changed = true; |
| 570 | 570 | } |
| 571 | 571 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | if ($this->context->debug) { |
| 575 | 575 | $this->context->debug('EMPTY nonterminals: '); |
| 576 | 576 | foreach ($this->context->nonterminals as $symbol) { |
| 577 | - if ($symbol->associativity & Production::EMPTY) { |
|
| 577 | + if ($symbol->associativity & Production::empty) { |
|
| 578 | 578 | $this->context->debug(' '.$symbol->name); |
| 579 | 579 | } |
| 580 | 580 | } |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | */ |
| 682 | 682 | protected function findEmpty(Lr1 $tail, Symbol $x): Lr1 |
| 683 | 683 | { |
| 684 | - if (!$this->visited[$x->code] && ($x->associativity & Production::EMPTY)) { |
|
| 684 | + if (!$this->visited[$x->code] && ($x->associativity & Production::empty)) { |
|
| 685 | 685 | $this->visited[$x->code] = true; |
| 686 | 686 | |
| 687 | 687 | /** @var Production $gram */ |
@@ -434,7 +434,7 @@ |
||
| 434 | 434 | * |
| 435 | 435 | * @throws LogicException |
| 436 | 436 | * |
| 437 | - * @return int|mixed |
|
| 437 | + * @return integer |
|
| 438 | 438 | */ |
| 439 | 439 | protected function comparePrecedence(Production $gram, Symbol $x) |
| 440 | 440 | { |
@@ -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; |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Production |
| 18 | 18 | { |
| 19 | - const EMPTY = 0x10; |
|
| 19 | + const empty = 0x10; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @var Production|null |
@@ -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]; |
@@ -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 | } |
@@ -332,7 +332,7 @@ |
||
| 332 | 332 | $this->context->debug("Used aux table:\n"); |
| 333 | 333 | } |
| 334 | 334 | $this->context->countAux = $this->context->countClasses; |
| 335 | - for (; ;) { |
|
| 335 | + for (;;) { |
|
| 336 | 336 | $maxGain = 0; |
| 337 | 337 | $maxAux = null; |
| 338 | 338 | $pre = null; |