@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | protected function reduce(int $followingPrecedence): void |
| 84 | 84 | { |
| 85 | - $i = count($this->resultStack) - 1; // `i` always equals the index of the last node. |
|
| 85 | + $i = count($this->resultStack)-1; // `i` always equals the index of the last node. |
|
| 86 | 86 | for ($opIndex = count($this->opStack); $opIndex--;) { |
| 87 | 87 | $op = $this->opStack[$opIndex]; |
| 88 | 88 | if (!$this->shouldReduce($op, $followingPrecedence)) { |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function finishCircumfixOp($token): bool |
| 136 | 136 | { |
| 137 | - if (!(bool)$this->acceptorStack) { |
|
| 137 | + if (!(bool) $this->acceptorStack) { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | 140 | // Check the token with the most deeply nested operator. |
| 141 | - $factory = $this->acceptorStack[count($this->acceptorStack) - 1]->accept($token); |
|
| 141 | + $factory = $this->acceptorStack[count($this->acceptorStack)-1]->accept($token); |
|
| 142 | 142 | if ($factory === null) { |
| 143 | 143 | return false; |
| 144 | 144 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | }; |
| 189 | 189 | } else { |
| 190 | 190 | // A circumfix operator does not have precedence. Reduce it right away. |
| 191 | - $i = count($this->resultStack) - 1; |
|
| 191 | + $i = count($this->resultStack)-1; |
|
| 192 | 192 | /** @var callable(Result): Result $factory */ |
| 193 | 193 | $this->resultStack[$i] = $factory($this->resultStack[$i]); |
| 194 | 194 | } |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function parse(iterable $tokens) |
| 238 | 238 | { |
| 239 | - assert(!(bool)$this->resultStack); // We are not reenterable. |
|
| 240 | - assert(!(bool)$this->opStack); |
|
| 239 | + assert(!(bool) $this->resultStack); // We are not reenterable. |
|
| 240 | + assert(!(bool) $this->opStack); |
|
| 241 | 241 | $waitingForTerm = true; |
| 242 | 242 | try { |
| 243 | 243 | foreach ($tokens as $this->position => $token) { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | ) : new MissingOperandException(); |
| 257 | 257 | } |
| 258 | 258 | $this->reduce(PHP_INT_MIN); |
| 259 | - if ((bool)$this->opStack) { |
|
| 259 | + if ((bool) $this->opStack) { |
|
| 260 | 260 | throw new UnclosedBracketException(); |
| 261 | 261 | } |
| 262 | 262 | } catch (\Throwable $e) { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function __construct(IOpDefinition $op, int $position) |
| 15 | 15 | { |
| 16 | - parent::__construct('Operator `' . get_class($op) . '` is non-associative', $position); |
|
| 16 | + parent::__construct('Operator `'.get_class($op).'` is non-associative', $position); |
|
| 17 | 17 | $this->op = $op; |
| 18 | 18 | } |
| 19 | 19 | } |