@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param Expression $expr the expression that we are sorting by |
| 35 | 35 | * @param string $type the sorting type |
| 36 | 36 | */ |
| 37 | - public function __construct(Expression|null $expr = null, string $type = 'ASC') |
|
| 37 | + public function __construct(Expression | null $expr = null, string $type = 'ASC') |
|
| 38 | 38 | { |
| 39 | 39 | $this->expr = $expr; |
| 40 | 40 | $this->type = $type; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | ) { |
| 94 | 94 | $expr->type = $token->keyword; |
| 95 | 95 | } elseif (($token->type === TokenType::Operator) && ($token->value === ',')) { |
| 96 | - if (! empty($expr->expr)) { |
|
| 96 | + if (!empty($expr->expr)) { |
|
| 97 | 97 | $ret[] = $expr; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Last iteration was not processed. |
| 109 | - if (! empty($expr->expr)) { |
|
| 109 | + if (!empty($expr->expr)) { |
|
| 110 | 110 | $ret[] = $expr; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | * @param ArrayObj $using columns joined |
| 80 | 80 | */ |
| 81 | 81 | public function __construct( |
| 82 | - string|null $type = null, |
|
| 83 | - Expression|null $expr = null, |
|
| 84 | - array|null $on = null, |
|
| 85 | - ArrayObj|null $using = null |
|
| 82 | + string | null $type = null, |
|
| 83 | + Expression | null $expr = null, |
|
| 84 | + array | null $on = null, |
|
| 85 | + ArrayObj | null $using = null |
|
| 86 | 86 | ) { |
| 87 | 87 | $this->type = $type; |
| 88 | 88 | $this->expr = $expr; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if (! empty($expr->type)) { |
|
| 195 | + if (!empty($expr->type)) { |
|
| 196 | 196 | $ret[] = $expr; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -214,9 +214,9 @@ discard block |
||
| 214 | 214 | $ret = []; |
| 215 | 215 | foreach ($component as $c) { |
| 216 | 216 | $ret[] = array_search($c->type, self::JOINS) . ' ' . $c->expr |
| 217 | - . (! empty($c->on) |
|
| 217 | + . (!empty($c->on) |
|
| 218 | 218 | ? ' ON ' . Condition::buildAll($c->on) : '') |
| 219 | - . (! empty($c->using) |
|
| 219 | + . (!empty($c->using) |
|
| 220 | 220 | ? ' USING ' . $c->using->build() : ''); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * Gets the next token. Skips any irrelevant token (whitespaces and |
| 79 | 79 | * comments). |
| 80 | 80 | */ |
| 81 | - public function getNext(): Token|null |
|
| 81 | + public function getNext(): Token | null |
|
| 82 | 82 | { |
| 83 | 83 | for (; $this->idx < $this->count; ++$this->idx) { |
| 84 | 84 | if ( |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * Gets the previous token. Skips any irrelevant token (whitespaces and |
| 97 | 97 | * comments). |
| 98 | 98 | */ |
| 99 | - public function getPrevious(): Token|null |
|
| 99 | + public function getPrevious(): Token | null |
|
| 100 | 100 | { |
| 101 | 101 | for (; $this->idx >= 0; --$this->idx) { |
| 102 | 102 | if ( |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @param TokenType|TokenType[] $type the type |
| 117 | 117 | */ |
| 118 | - public function getPreviousOfType(TokenType|array $type): Token|null |
|
| 118 | + public function getPreviousOfType(TokenType | array $type): Token | null |
|
| 119 | 119 | { |
| 120 | - if (! is_array($type)) { |
|
| 120 | + if (!is_array($type)) { |
|
| 121 | 121 | $type = [$type]; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @param TokenType|TokenType[] $type the type |
| 137 | 137 | */ |
| 138 | - public function getNextOfType(TokenType|array $type): Token|null |
|
| 138 | + public function getNextOfType(TokenType | array $type): Token | null |
|
| 139 | 139 | { |
| 140 | - if (! is_array($type)) { |
|
| 140 | + if (!is_array($type)) { |
|
| 141 | 141 | $type = [$type]; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param TokenType $type the type of the token |
| 157 | 157 | * @param string $value the value of the token |
| 158 | 158 | */ |
| 159 | - public function getNextOfTypeAndValue(TokenType $type, string $value): Token|null |
|
| 159 | + public function getNextOfTypeAndValue(TokenType $type, string $value): Token | null |
|
| 160 | 160 | { |
| 161 | 161 | for (; $this->idx < $this->count; ++$this->idx) { |
| 162 | 162 | if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->value === $value)) { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @param TokenType $type the type of the token |
| 174 | 174 | * @param int $flag the flag of the token |
| 175 | 175 | */ |
| 176 | - public function getNextOfTypeAndFlag(TokenType $type, int $flag): Token|null |
|
| 176 | + public function getNextOfTypeAndFlag(TokenType $type, int $flag): Token | null |
|
| 177 | 177 | { |
| 178 | 178 | for (; $this->idx < $this->count; ++$this->idx) { |
| 179 | 179 | if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->flags === $flag)) { |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @param int $offset the offset to be returned |
| 206 | 206 | */ |
| 207 | - public function offsetGet(mixed $offset): Token|null |
|
| 207 | + public function offsetGet(mixed $offset): Token | null |
|
| 208 | 208 | { |
| 209 | 209 | return $offset < $this->count ? $this->tokens[$offset] : null; |
| 210 | 210 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * enabled or not |
| 128 | 128 | * @param string $delimiter the delimiter to be used |
| 129 | 129 | */ |
| 130 | - public function __construct(string|UtfString $str, bool $strict = false, string|null $delimiter = null) |
|
| 130 | + public function __construct(string | UtfString $str, bool $strict = false, string | null $delimiter = null) |
|
| 131 | 131 | { |
| 132 | 132 | if (Context::$keywords === []) { |
| 133 | 133 | Context::load(); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $len = $str instanceof UtfString ? $str->length() : strlen($str); |
| 139 | 139 | |
| 140 | 140 | // For multi-byte strings, a new instance of `UtfString` is initialized. |
| 141 | - if (! $str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 141 | + if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 142 | 142 | $str = new UtfString($str); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $this->strict = $strict; |
| 149 | 149 | |
| 150 | 150 | // Setting the delimiter. |
| 151 | - $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
| 151 | + $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
| 152 | 152 | |
| 153 | 153 | $this->lex(); |
| 154 | 154 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $delimiterLen = 0; |
| 258 | 258 | while ( |
| 259 | 259 | ++$this->last < $this->len |
| 260 | - && ! Context::isWhitespace($this->str[$this->last]) |
|
| 260 | + && !Context::isWhitespace($this->str[$this->last]) |
|
| 261 | 261 | && $delimiterLen < 15 |
| 262 | 262 | ) { |
| 263 | 263 | $this->delimiter .= $this->str[$this->last]; |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | if ( |
| 319 | - ($next->type !== TokenType::Keyword || ! in_array($next->value, ['FROM', 'USING'], true)) |
|
| 320 | - && ($next->type !== TokenType::Operator || ! in_array($next->value, [',', ')'], true)) |
|
| 319 | + ($next->type !== TokenType::Keyword || !in_array($next->value, ['FROM', 'USING'], true)) |
|
| 320 | + && ($next->type !== TokenType::Operator || !in_array($next->value, [',', ')'], true)) |
|
| 321 | 321 | ) { |
| 322 | 322 | continue; |
| 323 | 323 | } |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | $next = $this->list->getNext(); |
| 356 | 356 | if ( |
| 357 | 357 | ($next->type !== TokenType::Keyword |
| 358 | - || ! in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
| 358 | + || !in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
| 359 | 359 | ) |
| 360 | 360 | && ($next->type !== TokenType::Operator |
| 361 | - || ! in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
| 361 | + || !in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
| 362 | 362 | ) |
| 363 | 363 | && ($next->value !== null) |
| 364 | 364 | ) { |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | /** |
| 403 | 403 | * Parses a keyword. |
| 404 | 404 | */ |
| 405 | - public function parseKeyword(): Token|null |
|
| 405 | + public function parseKeyword(): Token | null |
|
| 406 | 406 | { |
| 407 | 407 | $token = ''; |
| 408 | 408 | |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $token .= $this->str[$this->last]; |
| 443 | 443 | $flags = Context::isKeyword($token); |
| 444 | 444 | |
| 445 | - if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) { |
|
| 445 | + if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) { |
|
| 446 | 446 | continue; |
| 447 | 447 | } |
| 448 | 448 | |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | /** |
| 463 | 463 | * Parses a label. |
| 464 | 464 | */ |
| 465 | - public function parseLabel(): Token|null |
|
| 465 | + public function parseLabel(): Token | null |
|
| 466 | 466 | { |
| 467 | 467 | $token = ''; |
| 468 | 468 | |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | /** |
| 507 | 507 | * Parses an operator. |
| 508 | 508 | */ |
| 509 | - public function parseOperator(): Token|null |
|
| 509 | + public function parseOperator(): Token | null |
|
| 510 | 510 | { |
| 511 | 511 | $token = ''; |
| 512 | 512 | |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $token .= $this->str[$this->last]; |
| 527 | 527 | $flags = Context::isOperator($token); |
| 528 | 528 | |
| 529 | - if (! $flags) { |
|
| 529 | + if (!$flags) { |
|
| 530 | 530 | continue; |
| 531 | 531 | } |
| 532 | 532 | |
@@ -542,11 +542,11 @@ discard block |
||
| 542 | 542 | /** |
| 543 | 543 | * Parses a whitespace. |
| 544 | 544 | */ |
| 545 | - public function parseWhitespace(): Token|null |
|
| 545 | + public function parseWhitespace(): Token | null |
|
| 546 | 546 | { |
| 547 | 547 | $token = $this->str[$this->last]; |
| 548 | 548 | |
| 549 | - if (! Context::isWhitespace($token)) { |
|
| 549 | + if (!Context::isWhitespace($token)) { |
|
| 550 | 550 | return null; |
| 551 | 551 | } |
| 552 | 552 | |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | /** |
| 563 | 563 | * Parses a comment. |
| 564 | 564 | */ |
| 565 | - public function parseComment(): Token|null |
|
| 565 | + public function parseComment(): Token | null |
|
| 566 | 566 | { |
| 567 | 567 | $iBak = $this->last; |
| 568 | 568 | $token = $this->str[$this->last]; |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | /** |
| 680 | 680 | * Parses a boolean. |
| 681 | 681 | */ |
| 682 | - public function parseBool(): Token|null |
|
| 682 | + public function parseBool(): Token | null |
|
| 683 | 683 | { |
| 684 | 684 | if ($this->last + 3 >= $this->len) { |
| 685 | 685 | // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | /** |
| 711 | 711 | * Parses a number. |
| 712 | 712 | */ |
| 713 | - public function parseNumber(): Token|null |
|
| 713 | + public function parseNumber(): Token | null |
|
| 714 | 714 | { |
| 715 | 715 | // A rudimentary state machine is being used to parse numbers due to |
| 716 | 716 | // the various forms of their notation. |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | } elseif ($state === 2) { |
| 778 | 778 | $flags |= Token::FLAG_NUMBER_HEX; |
| 779 | 779 | if ( |
| 780 | - ! ( |
|
| 780 | + !( |
|
| 781 | 781 | ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') |
| 782 | 782 | || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F') |
| 783 | 783 | || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f') |
@@ -873,12 +873,12 @@ discard block |
||
| 873 | 873 | * |
| 874 | 874 | * @throws LexerException |
| 875 | 875 | */ |
| 876 | - public function parseString(string $quote = ''): Token|null |
|
| 876 | + public function parseString(string $quote = ''): Token | null |
|
| 877 | 877 | { |
| 878 | 878 | $token = $this->str[$this->last]; |
| 879 | 879 | $flags = Context::isString($token); |
| 880 | 880 | |
| 881 | - if (! $flags && $token !== $quote) { |
|
| 881 | + if (!$flags && $token !== $quote) { |
|
| 882 | 882 | return null; |
| 883 | 883 | } |
| 884 | 884 | |
@@ -923,12 +923,12 @@ discard block |
||
| 923 | 923 | * |
| 924 | 924 | * @throws LexerException |
| 925 | 925 | */ |
| 926 | - public function parseSymbol(): Token|null |
|
| 926 | + public function parseSymbol(): Token | null |
|
| 927 | 927 | { |
| 928 | 928 | $token = $this->str[$this->last]; |
| 929 | 929 | $flags = Context::isSymbol($token); |
| 930 | 930 | |
| 931 | - if (! $flags) { |
|
| 931 | + if (!$flags) { |
|
| 932 | 932 | return null; |
| 933 | 933 | } |
| 934 | 934 | |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | if ($str === null) { |
| 955 | 955 | $str = $this->parseUnknown(); |
| 956 | 956 | |
| 957 | - if ($str === null && ! ($flags & Token::FLAG_SYMBOL_PARAMETER)) { |
|
| 957 | + if ($str === null && !($flags & Token::FLAG_SYMBOL_PARAMETER)) { |
|
| 958 | 958 | $this->error('Variable name was expected.', $this->str[$this->last], $this->last); |
| 959 | 959 | } |
| 960 | 960 | } |
@@ -970,14 +970,14 @@ discard block |
||
| 970 | 970 | /** |
| 971 | 971 | * Parses unknown parts of the query. |
| 972 | 972 | */ |
| 973 | - public function parseUnknown(): Token|null |
|
| 973 | + public function parseUnknown(): Token | null |
|
| 974 | 974 | { |
| 975 | 975 | $token = $this->str[$this->last]; |
| 976 | 976 | if (Context::isSeparator($token)) { |
| 977 | 977 | return null; |
| 978 | 978 | } |
| 979 | 979 | |
| 980 | - while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) { |
|
| 980 | + while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) { |
|
| 981 | 981 | $token .= $this->str[$this->last]; |
| 982 | 982 | |
| 983 | 983 | // Test if end of token equals the current delimiter. If so, remove it from the token. |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | /** |
| 997 | 997 | * Parses the delimiter of the query. |
| 998 | 998 | */ |
| 999 | - public function parseDelimiter(): Token|null |
|
| 999 | + public function parseDelimiter(): Token | null |
|
| 1000 | 1000 | { |
| 1001 | 1001 | $idx = 0; |
| 1002 | 1002 | |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | return new Token($this->delimiter, TokenType::Delimiter); |
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | - private function parse(): Token|null |
|
| 1016 | + private function parse(): Token | null |
|
| 1017 | 1017 | { |
| 1018 | 1018 | // It is best to put the parsers in order of their complexity |
| 1019 | 1019 | // (ascending) and their occurrence rate (descending). |
@@ -358,13 +358,13 @@ discard block |
||
| 358 | 358 | * |
| 359 | 359 | * @param bool $isReserved checks if the keyword is reserved |
| 360 | 360 | */ |
| 361 | - public static function isKeyword(string $string, bool $isReserved = false): int|null |
|
| 361 | + public static function isKeyword(string $string, bool $isReserved = false): int | null |
|
| 362 | 362 | { |
| 363 | 363 | $upperString = strtoupper($string); |
| 364 | 364 | |
| 365 | 365 | if ( |
| 366 | - ! isset(static::$keywords[$upperString]) |
|
| 367 | - || ($isReserved && ! (static::$keywords[$upperString] & Token::FLAG_KEYWORD_RESERVED)) |
|
| 366 | + !isset(static::$keywords[$upperString]) |
|
| 367 | + || ($isReserved && !(static::$keywords[$upperString] & Token::FLAG_KEYWORD_RESERVED)) |
|
| 368 | 368 | ) { |
| 369 | 369 | return null; |
| 370 | 370 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | /** |
| 376 | 376 | * Checks if the given string is an operator and returns the appropriate flag for the operator. |
| 377 | 377 | */ |
| 378 | - public static function isOperator(string $string): int|null |
|
| 378 | + public static function isOperator(string $string): int | null |
|
| 379 | 379 | { |
| 380 | 380 | return static::$operators[$string] ?? null; |
| 381 | 381 | } |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | * |
| 394 | 394 | * @return int|null the appropriate flag for the comment type |
| 395 | 395 | */ |
| 396 | - public static function isComment(string $string, bool $end = false): int|null |
|
| 396 | + public static function isComment(string $string, bool $end = false): int | null |
|
| 397 | 397 | { |
| 398 | 398 | if ($string === '') { |
| 399 | 399 | return null; |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | * |
| 457 | 457 | * @return int|null the appropriate flag for the symbol type |
| 458 | 458 | */ |
| 459 | - public static function isSymbol(string $string): int|null |
|
| 459 | + public static function isSymbol(string $string): int | null |
|
| 460 | 460 | { |
| 461 | 461 | if ($string === '') { |
| 462 | 462 | return null; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | * |
| 485 | 485 | * @return int|null the appropriate flag for the string type |
| 486 | 486 | */ |
| 487 | - public static function isString(string $string): int|null |
|
| 487 | + public static function isString(string $string): int | null |
|
| 488 | 488 | { |
| 489 | 489 | if ($string === '') { |
| 490 | 490 | return null; |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | $context = self::$contextPrefix . $context; |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | - if (! class_exists($context)) { |
|
| 541 | + if (!class_exists($context)) { |
|
| 542 | 542 | return false; |
| 543 | 543 | } |
| 544 | 544 | |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | * |
| 561 | 561 | * @return string|null The loaded context. `null` if no context was loaded. |
| 562 | 562 | */ |
| 563 | - public static function loadClosest(string $context = ''): string|null |
|
| 563 | + public static function loadClosest(string $context = ''): string | null |
|
| 564 | 564 | { |
| 565 | 565 | $length = strlen($context); |
| 566 | 566 | for ($i = $length; $i > 0;) { |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $i -= 2; |
| 575 | 575 | $part = substr($context, $i, 2); |
| 576 | 576 | /* No more numeric parts to strip */ |
| 577 | - if (! is_numeric($part)) { |
|
| 577 | + if (!is_numeric($part)) { |
|
| 578 | 578 | break 2; |
| 579 | 579 | } |
| 580 | 580 | } while (intval($part) === 0 && $i > 0); |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | /** |
| 606 | 606 | * Sets the SQL mode. |
| 607 | 607 | */ |
| 608 | - public static function setMode(int|string $mode = self::SQL_MODE_NONE): void |
|
| 608 | + public static function setMode(int | string $mode = self::SQL_MODE_NONE): void |
|
| 609 | 609 | { |
| 610 | 610 | if (is_int($mode)) { |
| 611 | 611 | static::$mode = $mode; |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | public static function escape(string $str, string $quote = '`'): string |
| 674 | 674 | { |
| 675 | 675 | if ( |
| 676 | - (static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && ! ( |
|
| 676 | + (static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && !( |
|
| 677 | 677 | static::isKeyword($str, true) || self::doesIdentifierRequireQuoting($str) |
| 678 | 678 | ) |
| 679 | 679 | ) { |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | * |
| 711 | 711 | * @return bool false on empty param, true/false on given constant/int value |
| 712 | 712 | */ |
| 713 | - public static function hasMode(int|null $flag = null): bool |
|
| 713 | + public static function hasMode(int | null $flag = null): bool |
|
| 714 | 714 | { |
| 715 | 715 | if (empty($flag)) { |
| 716 | 716 | return false; |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | */ |
| 66 | 66 | public static function gettext(string $msgid): string |
| 67 | 67 | { |
| 68 | - if (! class_exists(Loader::class, true)) { |
|
| 68 | + if (!class_exists(Loader::class, true)) { |
|
| 69 | 69 | return $msgid; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -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', |