@@ -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); |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | public static function escape(string $str, string $quote = '`'): string |
676 | 676 | { |
677 | 677 | if ( |
678 | - (static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && ! ( |
|
678 | + (static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && !( |
|
679 | 679 | static::isKeyword($str, true) || self::doesIdentifierRequireQuoting($str) |
680 | 680 | ) |
681 | 681 | ) { |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * |
723 | 723 | * @return bool false on empty param, true/false on given constant/int value |
724 | 724 | */ |
725 | - public static function hasMode(int|null $flag = null): bool |
|
725 | + public static function hasMode(int | null $flag = null): bool |
|
726 | 726 | { |
727 | 727 | if (empty($flag)) { |
728 | 728 | return false; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $len = $str instanceof UtfString ? $str->length() : strlen($str); |
175 | 175 | |
176 | 176 | // For multi-byte strings, a new instance of `UtfString` is initialized. |
177 | - if (! $str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
177 | + if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
178 | 178 | $str = new UtfString($str); |
179 | 179 | } |
180 | 180 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->strict = $strict; |
185 | 185 | |
186 | 186 | // Setting the delimiter. |
187 | - $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
187 | + $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
188 | 188 | |
189 | 189 | $this->lex(); |
190 | 190 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $delimiterLen = 0; |
309 | 309 | while ( |
310 | 310 | ++$this->last < $this->len |
311 | - && ! Context::isWhitespace($this->str[$this->last]) |
|
311 | + && !Context::isWhitespace($this->str[$this->last]) |
|
312 | 312 | && $delimiterLen < 15 |
313 | 313 | ) { |
314 | 314 | $this->delimiter .= $this->str[$this->last]; |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | if ( |
370 | - ($next->type !== Token::TYPE_KEYWORD || ! in_array($next->value, ['FROM', 'USING'], true)) |
|
371 | - && ($next->type !== Token::TYPE_OPERATOR || ! in_array($next->value, [',', ')'], true)) |
|
370 | + ($next->type !== Token::TYPE_KEYWORD || !in_array($next->value, ['FROM', 'USING'], true)) |
|
371 | + && ($next->type !== Token::TYPE_OPERATOR || !in_array($next->value, [',', ')'], true)) |
|
372 | 372 | ) { |
373 | 373 | continue; |
374 | 374 | } |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | $next = $this->list->getNext(); |
407 | 407 | if ( |
408 | 408 | ($next->type !== Token::TYPE_KEYWORD |
409 | - || ! in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
409 | + || !in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
410 | 410 | ) |
411 | 411 | && ($next->type !== Token::TYPE_OPERATOR |
412 | - || ! in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
412 | + || !in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
413 | 413 | ) |
414 | 414 | && ($next->value !== null) |
415 | 415 | ) { |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | /** |
449 | 449 | * Parses a keyword. |
450 | 450 | */ |
451 | - public function parseKeyword(): Token|null |
|
451 | + public function parseKeyword(): Token | null |
|
452 | 452 | { |
453 | 453 | $token = ''; |
454 | 454 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $token .= $this->str[$this->last]; |
489 | 489 | $flags = Context::isKeyword($token); |
490 | 490 | |
491 | - if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) { |
|
491 | + if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) { |
|
492 | 492 | continue; |
493 | 493 | } |
494 | 494 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | /** |
509 | 509 | * Parses a label. |
510 | 510 | */ |
511 | - public function parseLabel(): Token|null |
|
511 | + public function parseLabel(): Token | null |
|
512 | 512 | { |
513 | 513 | $token = ''; |
514 | 514 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | /** |
553 | 553 | * Parses an operator. |
554 | 554 | */ |
555 | - public function parseOperator(): Token|null |
|
555 | + public function parseOperator(): Token | null |
|
556 | 556 | { |
557 | 557 | $token = ''; |
558 | 558 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $token .= $this->str[$this->last]; |
573 | 573 | $flags = Context::isOperator($token); |
574 | 574 | |
575 | - if (! $flags) { |
|
575 | + if (!$flags) { |
|
576 | 576 | continue; |
577 | 577 | } |
578 | 578 | |
@@ -588,11 +588,11 @@ discard block |
||
588 | 588 | /** |
589 | 589 | * Parses a whitespace. |
590 | 590 | */ |
591 | - public function parseWhitespace(): Token|null |
|
591 | + public function parseWhitespace(): Token | null |
|
592 | 592 | { |
593 | 593 | $token = $this->str[$this->last]; |
594 | 594 | |
595 | - if (! Context::isWhitespace($token)) { |
|
595 | + if (!Context::isWhitespace($token)) { |
|
596 | 596 | return null; |
597 | 597 | } |
598 | 598 | |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | /** |
609 | 609 | * Parses a comment. |
610 | 610 | */ |
611 | - public function parseComment(): Token|null |
|
611 | + public function parseComment(): Token | null |
|
612 | 612 | { |
613 | 613 | $iBak = $this->last; |
614 | 614 | $token = $this->str[$this->last]; |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | /** |
726 | 726 | * Parses a boolean. |
727 | 727 | */ |
728 | - public function parseBool(): Token|null |
|
728 | + public function parseBool(): Token | null |
|
729 | 729 | { |
730 | 730 | if ($this->last + 3 >= $this->len) { |
731 | 731 | // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | /** |
757 | 757 | * Parses a number. |
758 | 758 | */ |
759 | - public function parseNumber(): Token|null |
|
759 | + public function parseNumber(): Token | null |
|
760 | 760 | { |
761 | 761 | // A rudimentary state machine is being used to parse numbers due to |
762 | 762 | // the various forms of their notation. |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | } elseif ($state === 2) { |
827 | 827 | $flags |= Token::FLAG_NUMBER_HEX; |
828 | 828 | if ( |
829 | - ! ( |
|
829 | + !( |
|
830 | 830 | ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') |
831 | 831 | || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F') |
832 | 832 | || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f') |
@@ -922,12 +922,12 @@ discard block |
||
922 | 922 | * |
923 | 923 | * @throws LexerException |
924 | 924 | */ |
925 | - public function parseString($quote = ''): Token|null |
|
925 | + public function parseString($quote = ''): Token | null |
|
926 | 926 | { |
927 | 927 | $token = $this->str[$this->last]; |
928 | 928 | $flags = Context::isString($token); |
929 | 929 | |
930 | - if (! $flags && $token !== $quote) { |
|
930 | + if (!$flags && $token !== $quote) { |
|
931 | 931 | return null; |
932 | 932 | } |
933 | 933 | |
@@ -972,12 +972,12 @@ discard block |
||
972 | 972 | * |
973 | 973 | * @throws LexerException |
974 | 974 | */ |
975 | - public function parseSymbol(): Token|null |
|
975 | + public function parseSymbol(): Token | null |
|
976 | 976 | { |
977 | 977 | $token = $this->str[$this->last]; |
978 | 978 | $flags = Context::isSymbol($token); |
979 | 979 | |
980 | - if (! $flags) { |
|
980 | + if (!$flags) { |
|
981 | 981 | return null; |
982 | 982 | } |
983 | 983 | |
@@ -1019,14 +1019,14 @@ discard block |
||
1019 | 1019 | /** |
1020 | 1020 | * Parses unknown parts of the query. |
1021 | 1021 | */ |
1022 | - public function parseUnknown(): Token|null |
|
1022 | + public function parseUnknown(): Token | null |
|
1023 | 1023 | { |
1024 | 1024 | $token = $this->str[$this->last]; |
1025 | 1025 | if (Context::isSeparator($token)) { |
1026 | 1026 | return null; |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) { |
|
1029 | + while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) { |
|
1030 | 1030 | $token .= $this->str[$this->last]; |
1031 | 1031 | |
1032 | 1032 | // Test if end of token equals the current delimiter. If so, remove it from the token. |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | /** |
1046 | 1046 | * Parses the delimiter of the query. |
1047 | 1047 | */ |
1048 | - public function parseDelimiter(): Token|null |
|
1048 | + public function parseDelimiter(): Token | null |
|
1049 | 1049 | { |
1050 | 1050 | $idx = 0; |
1051 | 1051 |