@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $len = $str instanceof UtfString ? $str->length() : strlen($str); |
| 120 | 120 | |
| 121 | 121 | // For multi-byte strings, a new instance of `UtfString` is initialized. |
| 122 | - if (! $str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 122 | + if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 123 | 123 | $str = new UtfString($str); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $this->strict = $strict; |
| 130 | 130 | |
| 131 | 131 | // Setting the delimiter. |
| 132 | - $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
| 132 | + $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
| 133 | 133 | |
| 134 | 134 | $this->lex(); |
| 135 | 135 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $delimiterLen = 0; |
| 239 | 239 | while ( |
| 240 | 240 | ++$this->last < $this->len |
| 241 | - && ! Context::isWhitespace($this->str[$this->last]) |
|
| 241 | + && !Context::isWhitespace($this->str[$this->last]) |
|
| 242 | 242 | && $delimiterLen < 15 |
| 243 | 243 | ) { |
| 244 | 244 | $this->delimiter .= $this->str[$this->last]; |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if ( |
| 300 | - ($next->type !== TokenType::Keyword || ! in_array($next->value, ['FROM', 'USING'], true)) |
|
| 301 | - && ($next->type !== TokenType::Operator || ! in_array($next->value, [',', ')'], true)) |
|
| 300 | + ($next->type !== TokenType::Keyword || !in_array($next->value, ['FROM', 'USING'], true)) |
|
| 301 | + && ($next->type !== TokenType::Operator || !in_array($next->value, [',', ')'], true)) |
|
| 302 | 302 | ) { |
| 303 | 303 | continue; |
| 304 | 304 | } |
@@ -336,10 +336,10 @@ discard block |
||
| 336 | 336 | $next = $this->list->getNext(); |
| 337 | 337 | if ( |
| 338 | 338 | ($next->type !== TokenType::Keyword |
| 339 | - || ! in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
| 339 | + || !in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
| 340 | 340 | ) |
| 341 | 341 | && ($next->type !== TokenType::Operator |
| 342 | - || ! in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
| 342 | + || !in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
| 343 | 343 | ) |
| 344 | 344 | && ($next->value !== null) |
| 345 | 345 | ) { |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | /** |
| 379 | 379 | * Parses a keyword. |
| 380 | 380 | */ |
| 381 | - public function parseKeyword(): Token|null |
|
| 381 | + public function parseKeyword(): Token | null |
|
| 382 | 382 | { |
| 383 | 383 | $token = ''; |
| 384 | 384 | |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | $token .= $this->str[$this->last]; |
| 419 | 419 | $flags = Context::isKeyword($token); |
| 420 | 420 | |
| 421 | - if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) { |
|
| 421 | + if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) { |
|
| 422 | 422 | continue; |
| 423 | 423 | } |
| 424 | 424 | |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | /** |
| 439 | 439 | * Parses a label. |
| 440 | 440 | */ |
| 441 | - public function parseLabel(): Token|null |
|
| 441 | + public function parseLabel(): Token | null |
|
| 442 | 442 | { |
| 443 | 443 | $token = ''; |
| 444 | 444 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | /** |
| 483 | 483 | * Parses an operator. |
| 484 | 484 | */ |
| 485 | - public function parseOperator(): Token|null |
|
| 485 | + public function parseOperator(): Token | null |
|
| 486 | 486 | { |
| 487 | 487 | $token = ''; |
| 488 | 488 | |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $token .= $this->str[$this->last]; |
| 503 | 503 | $flags = Context::isOperator($token); |
| 504 | 504 | |
| 505 | - if (! $flags) { |
|
| 505 | + if (!$flags) { |
|
| 506 | 506 | continue; |
| 507 | 507 | } |
| 508 | 508 | |
@@ -518,11 +518,11 @@ discard block |
||
| 518 | 518 | /** |
| 519 | 519 | * Parses a whitespace. |
| 520 | 520 | */ |
| 521 | - public function parseWhitespace(): Token|null |
|
| 521 | + public function parseWhitespace(): Token | null |
|
| 522 | 522 | { |
| 523 | 523 | $token = $this->str[$this->last]; |
| 524 | 524 | |
| 525 | - if (! Context::isWhitespace($token)) { |
|
| 525 | + if (!Context::isWhitespace($token)) { |
|
| 526 | 526 | return null; |
| 527 | 527 | } |
| 528 | 528 | |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | /** |
| 539 | 539 | * Parses a comment. |
| 540 | 540 | */ |
| 541 | - public function parseComment(): Token|null |
|
| 541 | + public function parseComment(): Token | null |
|
| 542 | 542 | { |
| 543 | 543 | $iBak = $this->last; |
| 544 | 544 | $token = $this->str[$this->last]; |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | /** |
| 656 | 656 | * Parses a boolean. |
| 657 | 657 | */ |
| 658 | - public function parseBool(): Token|null |
|
| 658 | + public function parseBool(): Token | null |
|
| 659 | 659 | { |
| 660 | 660 | if ($this->last + 3 >= $this->len) { |
| 661 | 661 | // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | /** |
| 687 | 687 | * Parses a number. |
| 688 | 688 | */ |
| 689 | - public function parseNumber(): Token|null |
|
| 689 | + public function parseNumber(): Token | null |
|
| 690 | 690 | { |
| 691 | 691 | // A rudimentary state machine is being used to parse numbers due to |
| 692 | 692 | // the various forms of their notation. |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | } elseif ($state === 2) { |
| 754 | 754 | $flags |= Token::FLAG_NUMBER_HEX; |
| 755 | 755 | if ( |
| 756 | - ! ( |
|
| 756 | + !( |
|
| 757 | 757 | ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') |
| 758 | 758 | || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F') |
| 759 | 759 | || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f') |
@@ -849,12 +849,12 @@ discard block |
||
| 849 | 849 | * |
| 850 | 850 | * @throws LexerException |
| 851 | 851 | */ |
| 852 | - public function parseString($quote = ''): Token|null |
|
| 852 | + public function parseString($quote = ''): Token | null |
|
| 853 | 853 | { |
| 854 | 854 | $token = $this->str[$this->last]; |
| 855 | 855 | $flags = Context::isString($token); |
| 856 | 856 | |
| 857 | - if (! $flags && $token !== $quote) { |
|
| 857 | + if (!$flags && $token !== $quote) { |
|
| 858 | 858 | return null; |
| 859 | 859 | } |
| 860 | 860 | |
@@ -899,12 +899,12 @@ discard block |
||
| 899 | 899 | * |
| 900 | 900 | * @throws LexerException |
| 901 | 901 | */ |
| 902 | - public function parseSymbol(): Token|null |
|
| 902 | + public function parseSymbol(): Token | null |
|
| 903 | 903 | { |
| 904 | 904 | $token = $this->str[$this->last]; |
| 905 | 905 | $flags = Context::isSymbol($token); |
| 906 | 906 | |
| 907 | - if (! $flags) { |
|
| 907 | + if (!$flags) { |
|
| 908 | 908 | return null; |
| 909 | 909 | } |
| 910 | 910 | |
@@ -946,14 +946,14 @@ discard block |
||
| 946 | 946 | /** |
| 947 | 947 | * Parses unknown parts of the query. |
| 948 | 948 | */ |
| 949 | - public function parseUnknown(): Token|null |
|
| 949 | + public function parseUnknown(): Token | null |
|
| 950 | 950 | { |
| 951 | 951 | $token = $this->str[$this->last]; |
| 952 | 952 | if (Context::isSeparator($token)) { |
| 953 | 953 | return null; |
| 954 | 954 | } |
| 955 | 955 | |
| 956 | - while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) { |
|
| 956 | + while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) { |
|
| 957 | 957 | $token .= $this->str[$this->last]; |
| 958 | 958 | |
| 959 | 959 | // Test if end of token equals the current delimiter. If so, remove it from the token. |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | /** |
| 973 | 973 | * Parses the delimiter of the query. |
| 974 | 974 | */ |
| 975 | - public function parseDelimiter(): Token|null |
|
| 975 | + public function parseDelimiter(): Token | null |
|
| 976 | 976 | { |
| 977 | 977 | $idx = 0; |
| 978 | 978 | |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | return new Token($this->delimiter, TokenType::Delimiter); |
| 990 | 990 | } |
| 991 | 991 | |
| 992 | - private function parse(): Token|null |
|
| 992 | + private function parse(): Token | null |
|
| 993 | 993 | { |
| 994 | 994 | // It is best to put the parsers in order of their complexity |
| 995 | 995 | // (ascending) and their occurrence rate (descending). |