@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | * @param string|UtfString|TokensList|null $list the list of tokens to be parsed |
| 378 | 378 | * @param bool $strict whether strict mode should be enabled or not |
| 379 | 379 | */ |
| 380 | - public function __construct(string|UtfString|TokensList|null $list = null, bool $strict = false) |
|
| 380 | + public function __construct(string | UtfString | TokensList | null $list = null, bool $strict = false) |
|
| 381 | 381 | { |
| 382 | 382 | if (Context::$keywords === []) { |
| 383 | 383 | Context::load(); |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | $list->idx = $lastIdx; |
| 508 | 508 | } elseif (empty(self::STATEMENT_PARSERS[$token->keyword])) { |
| 509 | 509 | // Checking if it is a known statement that can be parsed. |
| 510 | - if (! isset(self::STATEMENT_PARSERS[$token->keyword])) { |
|
| 510 | + if (!isset(self::STATEMENT_PARSERS[$token->keyword])) { |
|
| 511 | 511 | // A statement is considered recognized if the parser |
| 512 | 512 | // is aware that it is a statement, but it does not have |
| 513 | 513 | // a parser for it yet. |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | |
| 548 | 548 | // Handles unions. |
| 549 | 549 | if ( |
| 550 | - ! empty($unionType) |
|
| 550 | + !empty($unionType) |
|
| 551 | 551 | && ($lastStatement instanceof SelectStatement) |
| 552 | 552 | && ($statement instanceof SelectStatement) |
| 553 | 553 | ) { |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | * |
| 635 | 635 | * @throws ParserException throws the exception, if strict mode is enabled. |
| 636 | 636 | */ |
| 637 | - public function error(string $msg, Token|null $token = null, int $code = 0): void |
|
| 637 | + public function error(string $msg, Token | null $token = null, int $code = 0): void |
|
| 638 | 638 | { |
| 639 | 639 | $error = new ParserException( |
| 640 | 640 | Translator::gettext($msg), |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | // The code below extracts only the relevant information. |
| 84 | 84 | |
| 85 | 85 | // Extracting lexer's errors. |
| 86 | - if (! empty($lexer->errors)) { |
|
| 86 | + if (!empty($lexer->errors)) { |
|
| 87 | 87 | /** @var LexerException $err */ |
| 88 | 88 | foreach ($lexer->errors as $err) { |
| 89 | 89 | $lexerErrors[] = [ |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Extracting parser's errors. |
| 101 | - if (! empty($parser->errors)) { |
|
| 101 | + if (!empty($parser->errors)) { |
|
| 102 | 102 | /** @var ParserException $err */ |
| 103 | 103 | foreach ($parser->errors as $err) { |
| 104 | 104 | $parserErrors[] = [ |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | string $type, |
| 138 | 138 | string $input, |
| 139 | 139 | string $output, |
| 140 | - string|null $debug = null, |
|
| 140 | + string | null $debug = null, |
|
| 141 | 141 | bool $ansi = false |
| 142 | 142 | ): void { |
| 143 | 143 | // Support query types: `lexer` / `parser`. |
| 144 | - if (! in_array($type, ['lexer', 'parser'])) { |
|
| 144 | + if (!in_array($type, ['lexer', 'parser'])) { |
|
| 145 | 145 | throw new Exception('Unknown test type (expected `lexer` or `parser`).'); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | 188 | // Remove the project path from .out file, it changes for each dev |
| 189 | - $projectFolder = dirname(__DIR__, 2);// Jump to root |
|
| 189 | + $projectFolder = dirname(__DIR__, 2); // Jump to root |
|
| 190 | 190 | $encoded = str_replace($projectFolder, '<project-root>', $encoded); |
| 191 | 191 | |
| 192 | 192 | file_put_contents($output, $encoded); |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | if (is_dir($inputFile)) { |
| 224 | 224 | // Creating required directories to maintain the structure. |
| 225 | 225 | // Ignoring errors if the folder structure exists already. |
| 226 | - if (! is_dir($outputFile)) { |
|
| 226 | + if (!is_dir($outputFile)) { |
|
| 227 | 227 | mkdir($outputFile); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - if (($debug !== null) && (! is_dir($debugFile))) { |
|
| 230 | + if (($debug !== null) && (!is_dir($debugFile))) { |
|
| 231 | 231 | mkdir($debugFile); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // Building the test. |
| 245 | - if (! file_exists($outputFile)) { |
|
| 245 | + if (!file_exists($outputFile)) { |
|
| 246 | 246 | echo sprintf("Building test for %s...\n", $inputFile); |
| 247 | 247 | static::build( |
| 248 | 248 | str_contains($inputFile, 'lex') ? 'lexer' : 'parser', |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | // Reserved, data types, keys, functions, etc. keywords. |
| 172 | 172 | foreach (static::$labelsFlags as $label => $flags) { |
| 173 | - if (! str_contains($value, $label)) { |
|
| 173 | + if (!str_contains($value, $label)) { |
|
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $value = strtoupper($value); |
| 193 | - if (! isset($types[$value])) { |
|
| 193 | + if (!isset($types[$value])) { |
|
| 194 | 194 | $types[$value] = $type; |
| 195 | 195 | } else { |
| 196 | 196 | $types[$value] |= $type; |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | $ret = []; |
| 201 | 201 | foreach ($types as $word => $type) { |
| 202 | 202 | $len = strlen($word); |
| 203 | - if (! isset($ret[$type])) { |
|
| 203 | + if (!isset($ret[$type])) { |
|
| 204 | 204 | $ret[$type] = []; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if (! isset($ret[$type][$len])) { |
|
| 207 | + if (!isset($ret[$type][$len])) { |
|
| 208 | 208 | $ret[$type][$len] = []; |
| 209 | 209 | } |
| 210 | 210 | |