@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | } elseif ($state === 1) { |
| 178 | 178 | if (($token->type === TokenType::Operator) && ($token->value === '(')) { |
| 179 | 179 | $positionBeforeSearch = $list->idx; |
| 180 | - $list->idx++;// Ignore the current token "(" or the search condition will always be true |
|
| 180 | + $list->idx++; // Ignore the current token "(" or the search condition will always be true |
|
| 181 | 181 | $nextToken = $list->getNext(); |
| 182 | - $list->idx = $positionBeforeSearch;// Restore the position |
|
| 182 | + $list->idx = $positionBeforeSearch; // Restore the position |
|
| 183 | 183 | |
| 184 | 184 | if ($nextToken !== null && $nextToken->value === '(') { |
| 185 | 185 | // Switch to expression mode |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | if ($token->type === TokenType::Operator) { |
| 229 | 229 | // This got back to here and we reached the end of the expression |
| 230 | 230 | if ($token->value === ')') { |
| 231 | - $state = 4;// go back to state 4 to fetch options |
|
| 231 | + $state = 4; // go back to state 4 to fetch options |
|
| 232 | 232 | continue; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | public static function build($component): string |
| 268 | 268 | { |
| 269 | 269 | $ret = $component->type . ' '; |
| 270 | - if (! empty($component->name)) { |
|
| 270 | + if (!empty($component->name)) { |
|
| 271 | 271 | $ret .= Context::escape($component->name) . ' '; |
| 272 | 272 | } |
| 273 | 273 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | // The options of a clause should stay on the same line and everything that follows. |
| 436 | 436 | if ( |
| 437 | 437 | $this->options['parts_newline'] |
| 438 | - && ! $formattedOptions |
|
| 438 | + && !$formattedOptions |
|
| 439 | 439 | && empty(self::$inlineClauses[$lastClause]) |
| 440 | 440 | && ( |
| 441 | 441 | $curr->type !== TokenType::Keyword |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | end($blocksLineEndings) === true |
| 493 | 493 | || ( |
| 494 | 494 | empty(self::$inlineClauses[$lastClause]) |
| 495 | - && ! $shortGroup |
|
| 495 | + && !$shortGroup |
|
| 496 | 496 | && $this->options['parts_newline'] |
| 497 | 497 | ) |
| 498 | 498 | ) { |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | $lineEnded = false; |
| 529 | 529 | } elseif ( |
| 530 | 530 | $prev->keyword === 'DELIMITER' |
| 531 | - || ! ( |
|
| 531 | + || !( |
|
| 532 | 532 | ($prev->type === TokenType::Operator && ($prev->value === '.' || $prev->value === '(')) |
| 533 | 533 | // No space after . ( |
| 534 | 534 | || ($curr->type === TokenType::Operator |
@@ -643,13 +643,13 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | foreach ($this->options['formats'] as $format) { |
| 645 | 645 | if ( |
| 646 | - $token->type->value !== $format['type'] || ! (($token->flags & $format['flags']) === $format['flags']) |
|
| 646 | + $token->type->value !== $format['type'] || !(($token->flags & $format['flags']) === $format['flags']) |
|
| 647 | 647 | ) { |
| 648 | 648 | continue; |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | 651 | // Running transformation function. |
| 652 | - if (! empty($format['function'])) { |
|
| 652 | + if (!empty($format['function'])) { |
|
| 653 | 653 | $func = $format['function']; |
| 654 | 654 | $text = $func($text); |
| 655 | 655 | } |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | * |
| 759 | 759 | * @psalm-return 1|2|false |
| 760 | 760 | */ |
| 761 | - public static function isClause($token): int|false |
|
| 761 | + public static function isClause($token): int | false |
|
| 762 | 762 | { |
| 763 | 763 | if ( |
| 764 | 764 | ($token->type === TokenType::Keyword && isset(Parser::$statementParsers[$token->keyword])) |
@@ -300,23 +300,23 @@ discard block |
||
| 300 | 300 | $flags['distinct'] = true; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - if (! empty($statement->group) || ! empty($statement->having)) { |
|
| 303 | + if (!empty($statement->group) || !empty($statement->having)) { |
|
| 304 | 304 | $flags['is_group'] = true; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if (! empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 307 | + if (!empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 308 | 308 | $flags['is_export'] = true; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $expressions = $statement->expr; |
| 312 | - if (! empty($statement->join)) { |
|
| 312 | + if (!empty($statement->join)) { |
|
| 313 | 313 | foreach ($statement->join as $join) { |
| 314 | 314 | $expressions[] = $join->expr; |
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | foreach ($expressions as $expr) { |
| 319 | - if (! empty($expr->function)) { |
|
| 319 | + if (!empty($expr->function)) { |
|
| 320 | 320 | if ($expr->function === 'COUNT') { |
| 321 | 321 | $flags['is_count'] = true; |
| 322 | 322 | } elseif (in_array($expr->function, static::$functions)) { |
@@ -331,15 +331,15 @@ discard block |
||
| 331 | 331 | $flags['is_subquery'] = true; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 334 | + if (!empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 335 | 335 | $flags['is_analyse'] = true; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if (! empty($statement->group)) { |
|
| 338 | + if (!empty($statement->group)) { |
|
| 339 | 339 | $flags['group'] = true; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if (! empty($statement->having)) { |
|
| 342 | + if (!empty($statement->having)) { |
|
| 343 | 343 | $flags['having'] = true; |
| 344 | 344 | } |
| 345 | 345 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $flags['union'] = true; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if (! empty($statement->join)) { |
|
| 350 | + if (!empty($statement->join)) { |
|
| 351 | 351 | $flags['join'] = true; |
| 352 | 352 | } |
| 353 | 353 | |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | || ($statement instanceof UpdateStatement) |
| 439 | 439 | || ($statement instanceof DeleteStatement) |
| 440 | 440 | ) { |
| 441 | - if (! empty($statement->limit)) { |
|
| 441 | + if (!empty($statement->limit)) { |
|
| 442 | 442 | $flags['limit'] = true; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - if (! empty($statement->order)) { |
|
| 445 | + if (!empty($statement->order)) { |
|
| 446 | 446 | $flags['order'] = true; |
| 447 | 447 | } |
| 448 | 448 | } |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | // Finding tables' aliases and their associated real names. |
| 493 | 493 | $tableAliases = []; |
| 494 | 494 | foreach ($statement->from as $expr) { |
| 495 | - if (! isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 495 | + if (!isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 496 | 496 | continue; |
| 497 | 497 | } |
| 498 | 498 | |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | ]; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - if (! in_array($arr, $ret['select_tables'])) { |
|
| 520 | + if (!in_array($arr, $ret['select_tables'])) { |
|
| 521 | 521 | $ret['select_tables'][] = $arr; |
| 522 | 522 | } |
| 523 | 523 | } else { |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | // extracted from the FROM clause. |
| 531 | 531 | if ($ret['select_tables'] === []) { |
| 532 | 532 | foreach ($statement->from as $expr) { |
| 533 | - if (! isset($expr->table) || ($expr->table === '')) { |
|
| 533 | + if (!isset($expr->table) || ($expr->table === '')) { |
|
| 534 | 534 | continue; |
| 535 | 535 | } |
| 536 | 536 | |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement)) { |
| 572 | 572 | $expressions = [$statement->table]; |
| 573 | 573 | } elseif ($statement instanceof DropStatement) { |
| 574 | - if (! $statement->options->has('TABLE')) { |
|
| 574 | + if (!$statement->options->has('TABLE')) { |
|
| 575 | 575 | // No tables are dropped. |
| 576 | 576 | return []; |
| 577 | 577 | } |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | |
| 846 | 846 | $statement .= $token->token; |
| 847 | 847 | |
| 848 | - if (($token->type === TokenType::Delimiter) && ! empty($token->token)) { |
|
| 848 | + if (($token->type === TokenType::Delimiter) && !empty($token->token)) { |
|
| 849 | 849 | $delimiter = $token->token; |
| 850 | 850 | $fullStatement = true; |
| 851 | 851 | break; |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | // No statement was found so we return the entire query as being the |
| 856 | 856 | // remaining part. |
| 857 | - if (! $fullStatement) { |
|
| 857 | + if (!$fullStatement) { |
|
| 858 | 858 | return [ |
| 859 | 859 | null, |
| 860 | 860 | $query, |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $len = $str instanceof UtfString ? $str->length() : strlen($str); |
| 182 | 182 | |
| 183 | 183 | // For multi-byte strings, a new instance of `UtfString` is initialized. |
| 184 | - if (! $str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 184 | + if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 185 | 185 | $str = new UtfString($str); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $this->strict = $strict; |
| 192 | 192 | |
| 193 | 193 | // Setting the delimiter. |
| 194 | - $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
| 194 | + $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
| 195 | 195 | |
| 196 | 196 | $this->lex(); |
| 197 | 197 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $delimiterLen = 0; |
| 316 | 316 | while ( |
| 317 | 317 | ++$this->last < $this->len |
| 318 | - && ! Context::isWhitespace($this->str[$this->last]) |
|
| 318 | + && !Context::isWhitespace($this->str[$this->last]) |
|
| 319 | 319 | && $delimiterLen < 15 |
| 320 | 320 | ) { |
| 321 | 321 | $this->delimiter .= $this->str[$this->last]; |
@@ -374,8 +374,8 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | if ( |
| 377 | - ($next->type !== TokenType::Keyword || ! in_array($next->value, ['FROM', 'USING'], true)) |
|
| 378 | - && ($next->type !== TokenType::Operator || ! in_array($next->value, [',', ')'], true)) |
|
| 377 | + ($next->type !== TokenType::Keyword || !in_array($next->value, ['FROM', 'USING'], true)) |
|
| 378 | + && ($next->type !== TokenType::Operator || !in_array($next->value, [',', ')'], true)) |
|
| 379 | 379 | ) { |
| 380 | 380 | continue; |
| 381 | 381 | } |
@@ -413,10 +413,10 @@ discard block |
||
| 413 | 413 | $next = $this->list->getNext(); |
| 414 | 414 | if ( |
| 415 | 415 | ($next->type !== TokenType::Keyword |
| 416 | - || ! in_array($next->value, $this->keywordNameIndicators, true) |
|
| 416 | + || !in_array($next->value, $this->keywordNameIndicators, true) |
|
| 417 | 417 | ) |
| 418 | 418 | && ($next->type !== TokenType::Operator |
| 419 | - || ! in_array($next->value, $this->operatorNameIndicators, true) |
|
| 419 | + || !in_array($next->value, $this->operatorNameIndicators, true) |
|
| 420 | 420 | ) |
| 421 | 421 | && ($next->value !== null) |
| 422 | 422 | ) { |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | /** |
| 456 | 456 | * Parses a keyword. |
| 457 | 457 | */ |
| 458 | - public function parseKeyword(): Token|null |
|
| 458 | + public function parseKeyword(): Token | null |
|
| 459 | 459 | { |
| 460 | 460 | $token = ''; |
| 461 | 461 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $token .= $this->str[$this->last]; |
| 496 | 496 | $flags = Context::isKeyword($token); |
| 497 | 497 | |
| 498 | - if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) { |
|
| 498 | + if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) { |
|
| 499 | 499 | continue; |
| 500 | 500 | } |
| 501 | 501 | |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | /** |
| 516 | 516 | * Parses a label. |
| 517 | 517 | */ |
| 518 | - public function parseLabel(): Token|null |
|
| 518 | + public function parseLabel(): Token | null |
|
| 519 | 519 | { |
| 520 | 520 | $token = ''; |
| 521 | 521 | |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | /** |
| 560 | 560 | * Parses an operator. |
| 561 | 561 | */ |
| 562 | - public function parseOperator(): Token|null |
|
| 562 | + public function parseOperator(): Token | null |
|
| 563 | 563 | { |
| 564 | 564 | $token = ''; |
| 565 | 565 | |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | $token .= $this->str[$this->last]; |
| 580 | 580 | $flags = Context::isOperator($token); |
| 581 | 581 | |
| 582 | - if (! $flags) { |
|
| 582 | + if (!$flags) { |
|
| 583 | 583 | continue; |
| 584 | 584 | } |
| 585 | 585 | |
@@ -595,11 +595,11 @@ discard block |
||
| 595 | 595 | /** |
| 596 | 596 | * Parses a whitespace. |
| 597 | 597 | */ |
| 598 | - public function parseWhitespace(): Token|null |
|
| 598 | + public function parseWhitespace(): Token | null |
|
| 599 | 599 | { |
| 600 | 600 | $token = $this->str[$this->last]; |
| 601 | 601 | |
| 602 | - if (! Context::isWhitespace($token)) { |
|
| 602 | + if (!Context::isWhitespace($token)) { |
|
| 603 | 603 | return null; |
| 604 | 604 | } |
| 605 | 605 | |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | /** |
| 616 | 616 | * Parses a comment. |
| 617 | 617 | */ |
| 618 | - public function parseComment(): Token|null |
|
| 618 | + public function parseComment(): Token | null |
|
| 619 | 619 | { |
| 620 | 620 | $iBak = $this->last; |
| 621 | 621 | $token = $this->str[$this->last]; |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | /** |
| 733 | 733 | * Parses a boolean. |
| 734 | 734 | */ |
| 735 | - public function parseBool(): Token|null |
|
| 735 | + public function parseBool(): Token | null |
|
| 736 | 736 | { |
| 737 | 737 | if ($this->last + 3 >= $this->len) { |
| 738 | 738 | // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | /** |
| 764 | 764 | * Parses a number. |
| 765 | 765 | */ |
| 766 | - public function parseNumber(): Token|null |
|
| 766 | + public function parseNumber(): Token | null |
|
| 767 | 767 | { |
| 768 | 768 | // A rudimentary state machine is being used to parse numbers due to |
| 769 | 769 | // the various forms of their notation. |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | } elseif ($state === 2) { |
| 834 | 834 | $flags |= Token::FLAG_NUMBER_HEX; |
| 835 | 835 | if ( |
| 836 | - ! ( |
|
| 836 | + !( |
|
| 837 | 837 | ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') |
| 838 | 838 | || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F') |
| 839 | 839 | || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f') |
@@ -929,12 +929,12 @@ discard block |
||
| 929 | 929 | * |
| 930 | 930 | * @throws LexerException |
| 931 | 931 | */ |
| 932 | - public function parseString($quote = ''): Token|null |
|
| 932 | + public function parseString($quote = ''): Token | null |
|
| 933 | 933 | { |
| 934 | 934 | $token = $this->str[$this->last]; |
| 935 | 935 | $flags = Context::isString($token); |
| 936 | 936 | |
| 937 | - if (! $flags && $token !== $quote) { |
|
| 937 | + if (!$flags && $token !== $quote) { |
|
| 938 | 938 | return null; |
| 939 | 939 | } |
| 940 | 940 | |
@@ -979,12 +979,12 @@ discard block |
||
| 979 | 979 | * |
| 980 | 980 | * @throws LexerException |
| 981 | 981 | */ |
| 982 | - public function parseSymbol(): Token|null |
|
| 982 | + public function parseSymbol(): Token | null |
|
| 983 | 983 | { |
| 984 | 984 | $token = $this->str[$this->last]; |
| 985 | 985 | $flags = Context::isSymbol($token); |
| 986 | 986 | |
| 987 | - if (! $flags) { |
|
| 987 | + if (!$flags) { |
|
| 988 | 988 | return null; |
| 989 | 989 | } |
| 990 | 990 | |
@@ -1026,14 +1026,14 @@ discard block |
||
| 1026 | 1026 | /** |
| 1027 | 1027 | * Parses unknown parts of the query. |
| 1028 | 1028 | */ |
| 1029 | - public function parseUnknown(): Token|null |
|
| 1029 | + public function parseUnknown(): Token | null |
|
| 1030 | 1030 | { |
| 1031 | 1031 | $token = $this->str[$this->last]; |
| 1032 | 1032 | if (Context::isSeparator($token)) { |
| 1033 | 1033 | return null; |
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | - while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) { |
|
| 1036 | + while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) { |
|
| 1037 | 1037 | $token .= $this->str[$this->last]; |
| 1038 | 1038 | |
| 1039 | 1039 | // Test if end of token equals the current delimiter. If so, remove it from the token. |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | /** |
| 1053 | 1053 | * Parses the delimiter of the query. |
| 1054 | 1054 | */ |
| 1055 | - public function parseDelimiter(): Token|null |
|
| 1055 | + public function parseDelimiter(): Token | null |
|
| 1056 | 1056 | { |
| 1057 | 1057 | $idx = 0; |
| 1058 | 1058 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * Used by all `CREATE` statements. |
| 283 | 283 | */ |
| 284 | - public Expression|null $name = null; |
|
| 284 | + public Expression | null $name = null; |
|
| 285 | 285 | |
| 286 | 286 | /** |
| 287 | 287 | * The options of the entity (table, procedure, function, etc.). |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | public function build(): string |
| 411 | 411 | { |
| 412 | 412 | $fields = ''; |
| 413 | - if (! empty($this->fields)) { |
|
| 413 | + if (!empty($this->fields)) { |
|
| 414 | 414 | if (is_array($this->fields)) { |
| 415 | 415 | $fields = CreateDefinition::buildAll($this->fields) . ' '; |
| 416 | 416 | } elseif ($this->fields instanceof ArrayObj) { |
@@ -449,23 +449,23 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | $partition = ''; |
| 451 | 451 | |
| 452 | - if (! empty($this->partitionBy)) { |
|
| 452 | + if (!empty($this->partitionBy)) { |
|
| 453 | 453 | $partition .= "\nPARTITION BY " . $this->partitionBy; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - if (! empty($this->partitionsNum)) { |
|
| 456 | + if (!empty($this->partitionsNum)) { |
|
| 457 | 457 | $partition .= "\nPARTITIONS " . $this->partitionsNum; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if (! empty($this->subpartitionBy)) { |
|
| 460 | + if (!empty($this->subpartitionBy)) { |
|
| 461 | 461 | $partition .= "\nSUBPARTITION BY " . $this->subpartitionBy; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - if (! empty($this->subpartitionsNum)) { |
|
| 464 | + if (!empty($this->subpartitionsNum)) { |
|
| 465 | 465 | $partition .= "\nSUBPARTITIONS " . $this->subpartitionsNum; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - if (! empty($this->partitions)) { |
|
| 468 | + if (!empty($this->partitions)) { |
|
| 469 | 469 | $partition .= "\n" . PartitionDefinition::buildAll($this->partitions); |
| 470 | 470 | } |
| 471 | 471 | |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | . OptionsArray::build($this->options) . ' ' |
| 490 | 490 | . Expression::build($this->name) . ' ' |
| 491 | 491 | . $fields . ' AS ' . $builtStatement |
| 492 | - . (! empty($this->body) ? TokensList::build($this->body) : '') . ' ' |
|
| 492 | + . (!empty($this->body) ? TokensList::build($this->body) : '') . ' ' |
|
| 493 | 493 | . OptionsArray::build($this->entityOptions); |
| 494 | 494 | } |
| 495 | 495 | |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | $token = $list->getNextOfType(TokenType::Number); |
| 660 | 660 | --$list->idx; // `getNextOfType` also advances one position. |
| 661 | 661 | $this->subpartitionsNum = $token->value; |
| 662 | - } elseif (! empty($field)) { |
|
| 662 | + } elseif (!empty($field)) { |
|
| 663 | 663 | /* |
| 664 | 664 | * Handling the content of `PARTITION BY` and `SUBPARTITION BY`. |
| 665 | 665 | */ |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | $field = null; |
| 689 | 689 | } |
| 690 | 690 | } elseif (($token->type === TokenType::Operator) && ($token->value === '(')) { |
| 691 | - if (! empty($this->partitionBy)) { |
|
| 691 | + if (!empty($this->partitionBy)) { |
|
| 692 | 692 | $this->partitions = ArrayObj::parse( |
| 693 | 693 | $parser, |
| 694 | 694 | $list, |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | break; |
| 131 | 131 | } |
| 132 | 132 | } elseif ($state === 2) { |
| 133 | - if (! ($token->type === TokenType::Keyword && $token->keyword === 'AS')) { |
|
| 133 | + if (!($token->type === TokenType::Keyword && $token->keyword === 'AS')) { |
|
| 134 | 134 | $parser->error('AS keyword was expected.', $token); |
| 135 | 135 | break; |
| 136 | 136 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $list->idx++; // Ignore the current token |
| 143 | 143 | $nextKeyword = $list->getNext(); |
| 144 | 144 | |
| 145 | - if (! ($token->value === '(' && ($nextKeyword && $nextKeyword->value === 'SELECT'))) { |
|
| 145 | + if (!($token->value === '(' && ($nextKeyword && $nextKeyword->value === 'SELECT'))) { |
|
| 146 | 146 | $parser->error('Subquery of the CTE was expected.', $token); |
| 147 | 147 | $list->idx = $idxBeforeGetNext; |
| 148 | 148 | break; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | /** |
| 290 | 290 | * Get tokens within the WITH expression to use them in another parser |
| 291 | 291 | */ |
| 292 | - private function getSubTokenList(TokensList $list): ParserException|TokensList |
|
| 292 | + private function getSubTokenList(TokensList $list): ParserException | TokensList |
|
| 293 | 293 | { |
| 294 | 294 | $idx = $list->idx; |
| 295 | 295 | $token = $list->tokens[$list->idx]; |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | ++$list->idx; |
| 308 | - if (! isset($list->tokens[$list->idx])) { |
|
| 308 | + if (!isset($list->tokens[$list->idx])) { |
|
| 309 | 309 | break; |
| 310 | 310 | } |
| 311 | 311 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * Gets the next token. Skips any irrelevant token (whitespaces and |
| 95 | 95 | * comments). |
| 96 | 96 | */ |
| 97 | - public function getNext(): Token|null |
|
| 97 | + public function getNext(): Token | null |
|
| 98 | 98 | { |
| 99 | 99 | for (; $this->idx < $this->count; ++$this->idx) { |
| 100 | 100 | if ( |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * Gets the previous token. Skips any irrelevant token (whitespaces and |
| 113 | 113 | * comments). |
| 114 | 114 | */ |
| 115 | - public function getPrevious(): Token|null |
|
| 115 | + public function getPrevious(): Token | null |
|
| 116 | 116 | { |
| 117 | 117 | for (; $this->idx >= 0; --$this->idx) { |
| 118 | 118 | if ( |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @param TokenType|TokenType[] $type the type |
| 133 | 133 | */ |
| 134 | - public function getPreviousOfType(TokenType|array $type): Token|null |
|
| 134 | + public function getPreviousOfType(TokenType | array $type): Token | null |
|
| 135 | 135 | { |
| 136 | - if (! is_array($type)) { |
|
| 136 | + if (!is_array($type)) { |
|
| 137 | 137 | $type = [$type]; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @param TokenType|TokenType[] $type the type |
| 153 | 153 | */ |
| 154 | - public function getNextOfType(TokenType|array $type): Token|null |
|
| 154 | + public function getNextOfType(TokenType | array $type): Token | null |
|
| 155 | 155 | { |
| 156 | - if (! is_array($type)) { |
|
| 156 | + if (!is_array($type)) { |
|
| 157 | 157 | $type = [$type]; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param TokenType $type the type of the token |
| 173 | 173 | * @param string $value the value of the token |
| 174 | 174 | */ |
| 175 | - public function getNextOfTypeAndValue(TokenType $type, $value): Token|null |
|
| 175 | + public function getNextOfTypeAndValue(TokenType $type, $value): Token | null |
|
| 176 | 176 | { |
| 177 | 177 | for (; $this->idx < $this->count; ++$this->idx) { |
| 178 | 178 | if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->value === $value)) { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * @param TokenType $type the type of the token |
| 190 | 190 | * @param int $flag the flag of the token |
| 191 | 191 | */ |
| 192 | - public function getNextOfTypeAndFlag(TokenType $type, int $flag): Token|null |
|
| 192 | + public function getNextOfTypeAndFlag(TokenType $type, int $flag): Token | null |
|
| 193 | 193 | { |
| 194 | 194 | for (; $this->idx < $this->count; ++$this->idx) { |
| 195 | 195 | if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->flags === $flag)) { |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | * @param int $offset the offset to be returned |
| 222 | 222 | */ |
| 223 | - public function offsetGet($offset): Token|null |
|
| 223 | + public function offsetGet($offset): Token | null |
|
| 224 | 224 | { |
| 225 | 225 | return $offset < $this->count ? $this->tokens[$offset] : null; |
| 226 | 226 | } |