@@ -233,7 +233,7 @@ |
||
233 | 233 | return trim( |
234 | 234 | 'PARTITION ' . $this->name |
235 | 235 | . (empty($this->type) ? '' : ' VALUES ' . $this->type . ' ' . $this->expr . ' ') |
236 | - . (! empty($this->options) && ! empty($this->type) ? '' : ' ') |
|
236 | + . (!empty($this->options) && !empty($this->type) ? '' : ' ') |
|
237 | 237 | . $this->options . $subpartitions |
238 | 238 | ); |
239 | 239 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $state = 4; |
243 | 243 | } elseif ($token->type === Token::TYPE_SYMBOL || $token->type === Token::TYPE_NONE) { |
244 | 244 | $expr->name = $token->value; |
245 | - if (! $expr->isConstraint) { |
|
245 | + if (!$expr->isConstraint) { |
|
246 | 246 | $state = 2; |
247 | 247 | } |
248 | 248 | } elseif ($token->type === Token::TYPE_KEYWORD) { |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | $state = 5; |
285 | 285 | } elseif ($state === 5) { |
286 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
286 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
287 | 287 | $ret[] = $expr; |
288 | 288 | } |
289 | 289 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | |
305 | 305 | // Last iteration was not saved. |
306 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
306 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
307 | 307 | $ret[] = $expr; |
308 | 308 | } |
309 | 309 | |
@@ -328,16 +328,16 @@ discard block |
||
328 | 328 | $tmp .= Context::escape($this->name) . ' '; |
329 | 329 | } |
330 | 330 | |
331 | - if (! empty($this->type)) { |
|
331 | + if (!empty($this->type)) { |
|
332 | 332 | $this->type->lowercase = true; |
333 | 333 | $tmp .= $this->type->build() . ' '; |
334 | 334 | } |
335 | 335 | |
336 | - if (! empty($this->key)) { |
|
336 | + if (!empty($this->key)) { |
|
337 | 337 | $tmp .= $this->key . ' '; |
338 | 338 | } |
339 | 339 | |
340 | - if (! empty($this->references)) { |
|
340 | + if (!empty($this->references)) { |
|
341 | 341 | $tmp .= 'REFERENCES ' . $this->references . ' '; |
342 | 342 | } |
343 | 343 |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * Used by all `CREATE` statements. |
282 | 282 | */ |
283 | - public Expression|null $name = null; |
|
283 | + public Expression | null $name = null; |
|
284 | 284 | |
285 | 285 | /** |
286 | 286 | * The options of the entity (table, procedure, function, etc.). |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | public function build(): string |
410 | 410 | { |
411 | 411 | $fields = ''; |
412 | - if (! empty($this->fields)) { |
|
412 | + if (!empty($this->fields)) { |
|
413 | 413 | if (is_array($this->fields)) { |
414 | 414 | $fields = CreateDefinition::buildAll($this->fields) . ' '; |
415 | 415 | } elseif ($this->fields instanceof ArrayObj) { |
@@ -448,23 +448,23 @@ discard block |
||
448 | 448 | |
449 | 449 | $partition = ''; |
450 | 450 | |
451 | - if (! empty($this->partitionBy)) { |
|
451 | + if (!empty($this->partitionBy)) { |
|
452 | 452 | $partition .= "\nPARTITION BY " . $this->partitionBy; |
453 | 453 | } |
454 | 454 | |
455 | - if (! empty($this->partitionsNum)) { |
|
455 | + if (!empty($this->partitionsNum)) { |
|
456 | 456 | $partition .= "\nPARTITIONS " . $this->partitionsNum; |
457 | 457 | } |
458 | 458 | |
459 | - if (! empty($this->subpartitionBy)) { |
|
459 | + if (!empty($this->subpartitionBy)) { |
|
460 | 460 | $partition .= "\nSUBPARTITION BY " . $this->subpartitionBy; |
461 | 461 | } |
462 | 462 | |
463 | - if (! empty($this->subpartitionsNum)) { |
|
463 | + if (!empty($this->subpartitionsNum)) { |
|
464 | 464 | $partition .= "\nSUBPARTITIONS " . $this->subpartitionsNum; |
465 | 465 | } |
466 | 466 | |
467 | - if (! empty($this->partitions)) { |
|
467 | + if (!empty($this->partitions)) { |
|
468 | 468 | $partition .= "\n" . PartitionDefinition::buildAll($this->partitions); |
469 | 469 | } |
470 | 470 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | . $this->options->build() . ' ' |
489 | 489 | . $this->name->build() . ' ' |
490 | 490 | . $fields . ' AS ' . $builtStatement |
491 | - . (! empty($this->body) ? TokensList::build($this->body) : '') . ' ' |
|
491 | + . (!empty($this->body) ? TokensList::build($this->body) : '') . ' ' |
|
492 | 492 | . ($this->entityOptions?->build() ?? ''); |
493 | 493 | } |
494 | 494 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $token = $list->getNextOfType(Token::TYPE_NUMBER); |
659 | 659 | --$list->idx; // `getNextOfType` also advances one position. |
660 | 660 | $this->subpartitionsNum = $token->value; |
661 | - } elseif (! empty($field)) { |
|
661 | + } elseif (!empty($field)) { |
|
662 | 662 | /* |
663 | 663 | * Handling the content of `PARTITION BY` and `SUBPARTITION BY`. |
664 | 664 | */ |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $field = null; |
688 | 688 | } |
689 | 689 | } elseif (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
690 | - if (! empty($this->partitionBy)) { |
|
690 | + if (!empty($this->partitionBy)) { |
|
691 | 691 | $this->partitions = ArrayObj::parse( |
692 | 692 | $parser, |
693 | 693 | $list, |
@@ -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 |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | // The options of a clause should stay on the same line and everything that follows. |
435 | 435 | if ( |
436 | 436 | $this->options['parts_newline'] |
437 | - && ! $formattedOptions |
|
437 | + && !$formattedOptions |
|
438 | 438 | && empty(self::$inlineClauses[$lastClause]) |
439 | 439 | && ( |
440 | 440 | $curr->type !== Token::TYPE_KEYWORD |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | end($blocksLineEndings) === true |
492 | 492 | || ( |
493 | 493 | empty(self::$inlineClauses[$lastClause]) |
494 | - && ! $shortGroup |
|
494 | + && !$shortGroup |
|
495 | 495 | && $this->options['parts_newline'] |
496 | 496 | ) |
497 | 497 | ) { |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $lineEnded = false; |
528 | 528 | } elseif ( |
529 | 529 | $prev->keyword === 'DELIMITER' |
530 | - || ! ( |
|
530 | + || !( |
|
531 | 531 | ($prev->type === Token::TYPE_OPERATOR && ($prev->value === '.' || $prev->value === '(')) |
532 | 532 | // No space after . ( |
533 | 533 | || ($curr->type === Token::TYPE_OPERATOR |
@@ -641,12 +641,12 @@ discard block |
||
641 | 641 | static $prev; |
642 | 642 | |
643 | 643 | foreach ($this->options['formats'] as $format) { |
644 | - if ($token->type !== $format['type'] || ! (($token->flags & $format['flags']) === $format['flags'])) { |
|
644 | + if ($token->type !== $format['type'] || !(($token->flags & $format['flags']) === $format['flags'])) { |
|
645 | 645 | continue; |
646 | 646 | } |
647 | 647 | |
648 | 648 | // Running transformation function. |
649 | - if (! empty($format['function'])) { |
|
649 | + if (!empty($format['function'])) { |
|
650 | 650 | $func = $format['function']; |
651 | 651 | $text = $func($text); |
652 | 652 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | * |
756 | 756 | * @psalm-return 1|2|false |
757 | 757 | */ |
758 | - public static function isClause($token): int|false |
|
758 | + public static function isClause($token): int | false |
|
759 | 759 | { |
760 | 760 | if ( |
761 | 761 | ($token->type === Token::TYPE_KEYWORD && isset(Parser::STATEMENT_PARSERS[$token->keyword])) |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $list->idx = $lastIdx; |
489 | 489 | } elseif (empty(self::STATEMENT_PARSERS[$token->keyword])) { |
490 | 490 | // Checking if it is a known statement that can be parsed. |
491 | - if (! isset(self::STATEMENT_PARSERS[$token->keyword])) { |
|
491 | + if (!isset(self::STATEMENT_PARSERS[$token->keyword])) { |
|
492 | 492 | // A statement is considered recognized if the parser |
493 | 493 | // is aware that it is a statement, but it does not have |
494 | 494 | // a parser for it yet. |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | |
529 | 529 | // Handles unions. |
530 | 530 | if ( |
531 | - ! empty($unionType) |
|
531 | + !empty($unionType) |
|
532 | 532 | && ($lastStatement instanceof SelectStatement) |
533 | 533 | && ($statement instanceof SelectStatement) |
534 | 534 | ) { |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @throws ParserException throws the exception, if strict mode is enabled. |
617 | 617 | */ |
618 | - public function error($msg, Token|null $token = null, $code = 0): void |
|
618 | + public function error($msg, Token | null $token = null, $code = 0): void |
|
619 | 619 | { |
620 | 620 | $error = new ParserException( |
621 | 621 | Translator::gettext($msg), |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param Parser|null $parser the instance that requests parsing |
89 | 89 | * @param TokensList|null $list the list of tokens to be parsed |
90 | 90 | */ |
91 | - public function __construct(Parser|null $parser = null, TokensList|null $list = null) |
|
91 | + public function __construct(Parser | null $parser = null, TokensList | null $list = null) |
|
92 | 92 | { |
93 | 93 | if (($parser === null) || ($list === null)) { |
94 | 94 | return; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | // Checking if this field was already built. |
167 | 167 | if ($type & 1) { |
168 | - if (! empty($built[$field])) { |
|
168 | + if (!empty($built[$field])) { |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | // Checking if the result of the builder should be added. |
181 | - if (! ($type & 1)) { |
|
181 | + if (!($type & 1)) { |
|
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | $options = []; |
305 | 305 | |
306 | 306 | // Looking for duplicated clauses. |
307 | - if (! empty(Parser::KEYWORD_PARSERS[$token->value]) || ! empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
308 | - if (! empty($parsedClauses[$token->value])) { |
|
307 | + if (!empty(Parser::KEYWORD_PARSERS[$token->value]) || !empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
308 | + if (!empty($parsedClauses[$token->value])) { |
|
309 | 309 | $parser->error('This type of clause was previously parsed.', $token); |
310 | 310 | break; |
311 | 311 | } |
@@ -318,18 +318,18 @@ discard block |
||
318 | 318 | // but it might be the beginning of a statement of truncate, |
319 | 319 | // so let the value use the keyword field for truncate type. |
320 | 320 | $tokenValue = in_array($token->keyword, ['TRUNCATE']) ? $token->keyword : $token->value; |
321 | - if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) { |
|
321 | + if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) { |
|
322 | 322 | $class = Parser::KEYWORD_PARSERS[$tokenValue]['class']; |
323 | 323 | $field = Parser::KEYWORD_PARSERS[$tokenValue]['field']; |
324 | - if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
324 | + if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
325 | 325 | $options = Parser::KEYWORD_PARSERS[$tokenValue]['options']; |
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | 329 | // Checking if this is the beginning of the statement. |
330 | - if (! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
330 | + if (!empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
331 | 331 | if ( |
332 | - ! empty(static::$clauses) // Undefined for some statements. |
|
332 | + !empty(static::$clauses) // Undefined for some statements. |
|
333 | 333 | && empty(static::$clauses[$token->value]) |
334 | 334 | ) { |
335 | 335 | // Some keywords (e.g. `SET`) may be the beginning of a |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | break; |
345 | 345 | } |
346 | 346 | |
347 | - if (! $parsedOptions) { |
|
347 | + if (!$parsedOptions) { |
|
348 | 348 | if (empty(static::$statementOptions[$token->value])) { |
349 | 349 | // Skipping keyword because if it is not a option. |
350 | 350 | ++$list->idx; |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | if ($minJoin === 0 && stripos($clauseType, 'JOIN')) { |
518 | 518 | // First JOIN clause is detected |
519 | 519 | $minJoin = $maxJoin = $clauseStartIdx; |
520 | - } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) { |
|
520 | + } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) { |
|
521 | 521 | // After a previous JOIN clause, a non-JOIN clause has been detected |
522 | 522 | $maxJoin = $lastIdx; |
523 | 523 | } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $this->str = $str; |
80 | 80 | $this->byteLen = mb_strlen($str, '8bit'); |
81 | - if (! mb_check_encoding($str, 'UTF-8')) { |
|
81 | + if (!mb_check_encoding($str, 'UTF-8')) { |
|
82 | 82 | $this->charLen = 0; |
83 | 83 | } else { |
84 | 84 | $this->charLen = mb_strlen($str, 'UTF-8'); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param int $offset the offset to be returned |
102 | 102 | */ |
103 | - public function offsetGet($offset): string|null |
|
103 | + public function offsetGet($offset): string | null |
|
104 | 104 | { |
105 | 105 | // This function moves the internal byte and character pointer to the requested offset. |
106 | 106 | // This function is part of hot code so the aim is to do the following |