@@ -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, |
@@ -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 | } |