Passed
Push — master ( 3b7191...72699f )
by Maurício
03:33 queued 14s
created
src/Components/AlterOperation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
      * @param Token[]                    $unknown    unparsed tokens found at the end of operation
265 265
      */
266 266
     public function __construct(
267
-        OptionsArray|null $options = null,
268
-        Expression|string|null $field = null,
269
-        array|null $partitions = null,
267
+        OptionsArray | null $options = null,
268
+        Expression | string | null $field = null,
269
+        array | null $partitions = null,
270 270
         public array $unknown = [],
271 271
     ) {
272 272
         $this->partitions = $partitions;
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                     } elseif (($token->value === ',') && ($brackets === 0)) {
402 402
                         break;
403 403
                     }
404
-                } elseif (! self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) {
404
+                } elseif (!self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) {
405 405
                     if (isset(Parser::STATEMENT_PARSERS[$arrayKey]) && Parser::STATEMENT_PARSERS[$arrayKey] !== '') {
406 406
                         $list->idx++; // Ignore the current token
407 407
                         $nextToken = $list->getNext();
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                     } elseif (
425 425
                         (array_key_exists($arrayKey, self::DATABASE_OPTIONS)
426 426
                         || array_key_exists($arrayKey, self::TABLE_OPTIONS))
427
-                        && ! self::checkIfColumnDefinitionKeyword($arrayKey)
427
+                        && !self::checkIfColumnDefinitionKeyword($arrayKey)
428 428
                     ) {
429 429
                         // This alter operation has finished, which means a comma
430 430
                         // was missing before start of new alter operation
Please login to merge, or discard this patch.
src/Context.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
      *
348 348
      * @param bool $isReserved checks if the keyword is reserved
349 349
      */
350
-    public static function isKeyword(string $string, bool $isReserved = false): int|null
350
+    public static function isKeyword(string $string, bool $isReserved = false): int | null
351 351
     {
352 352
         $upperString = strtoupper($string);
353 353
 
354 354
         if (
355
-            ! isset(static::$keywords[$upperString])
356
-            || ($isReserved && ! (static::$keywords[$upperString] & Token::FLAG_KEYWORD_RESERVED))
355
+            !isset(static::$keywords[$upperString])
356
+            || ($isReserved && !(static::$keywords[$upperString] & Token::FLAG_KEYWORD_RESERVED))
357 357
         ) {
358 358
             return null;
359 359
         }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     /**
365 365
      * Checks if the given string is an operator and returns the appropriate flag for the operator.
366 366
      */
367
-    public static function isOperator(string $string): int|null
367
+    public static function isOperator(string $string): int | null
368 368
     {
369 369
         return static::$operators[$string] ?? null;
370 370
     }
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
      *
383 383
      * @return int|null the appropriate flag for the comment type
384 384
      */
385
-    public static function isComment(string $string, bool $end = false): int|null
385
+    public static function isComment(string $string, bool $end = false): int | null
386 386
     {
387 387
         if ($string === '') {
388 388
             return null;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
      *
446 446
      * @return int|null the appropriate flag for the symbol type
447 447
      */
448
-    public static function isSymbol(string $string): int|null
448
+    public static function isSymbol(string $string): int | null
449 449
     {
450 450
         if ($string === '') {
451 451
             return null;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
      *
474 474
      * @return int|null the appropriate flag for the string type
475 475
      */
476
-    public static function isString(string $string): int|null
476
+    public static function isString(string $string): int | null
477 477
     {
478 478
         if ($string === '') {
479 479
             return null;
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
             $context = ContextMySql50700::class;
523 523
         }
524 524
 
525
-        if (! class_exists($context)) {
526
-            if (! class_exists(self::$contextPrefix . $context)) {
525
+        if (!class_exists($context)) {
526
+            if (!class_exists(self::$contextPrefix . $context)) {
527 527
                 return false;
528 528
             }
529 529
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
      *
550 550
      * @return string|null The loaded context. `null` if no context was loaded.
551 551
      */
552
-    public static function loadClosest(string $context = ''): string|null
552
+    public static function loadClosest(string $context = ''): string | null
553 553
     {
554 554
         $length = strlen($context);
555 555
         for ($i = $length; $i > 0;) {
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                 $i -= 2;
564 564
                 $part = substr($context, $i, 2);
565 565
                 /* No more numeric parts to strip */
566
-                if (! is_numeric($part)) {
566
+                if (!is_numeric($part)) {
567 567
                     break 2;
568 568
                 }
569 569
             } while (intval($part) === 0 && $i > 0);
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     /**
595 595
      * Sets the SQL mode.
596 596
      */
597
-    public static function setMode(int|string $mode = self::SQL_MODE_NONE): void
597
+    public static function setMode(int | string $mode = self::SQL_MODE_NONE): void
598 598
     {
599 599
         if (is_int($mode)) {
600 600
             static::$mode = $mode;
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
     public static function escape(string $str, string $quote = '`'): string
661 661
     {
662 662
         if (
663
-            (static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && ! (
663
+            (static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && !(
664 664
                 static::isKeyword($str, true) || self::doesIdentifierRequireQuoting($str)
665 665
             )
666 666
         ) {
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
      *
698 698
      * @return bool false on empty param, true/false on given constant/int value
699 699
      */
700
-    public static function hasMode(int|null $flag = null): bool
700
+    public static function hasMode(int | null $flag = null): bool
701 701
     {
702 702
         if (empty($flag)) {
703 703
             return false;
Please login to merge, or discard this patch.
src/Lexer.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      *                                    enabled or not
128 128
      * @param string           $delimiter the delimiter to be used
129 129
      */
130
-    public function __construct(string|UtfString $str, bool $strict = false, string|null $delimiter = null)
130
+    public function __construct(string | UtfString $str, bool $strict = false, string | null $delimiter = null)
131 131
     {
132 132
         if (Context::$keywords === []) {
133 133
             Context::load();
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $len = $str instanceof UtfString ? $str->length() : strlen($str);
139 139
 
140 140
         // For multi-byte strings, a new instance of `UtfString` is initialized.
141
-        if (! $str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) {
141
+        if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) {
142 142
             $str = new UtfString($str);
143 143
         }
144 144
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $this->strict = $strict;
149 149
 
150 150
         // Setting the delimiter.
151
-        $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter);
151
+        $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter);
152 152
 
153 153
         $this->lex();
154 154
     }
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                 $delimiterLen = 0;
258 258
                 while (
259 259
                     ++$this->last < $this->len
260
-                    && ! Context::isWhitespace($this->str[$this->last])
260
+                    && !Context::isWhitespace($this->str[$this->last])
261 261
                     && $delimiterLen < 15
262 262
                 ) {
263 263
                     $this->delimiter .= $this->str[$this->last];
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
             }
317 317
 
318 318
             if (
319
-                ($next->type !== TokenType::Keyword || ! in_array($next->value, ['FROM', 'USING'], true))
320
-                && ($next->type !== TokenType::Operator || ! in_array($next->value, [',', ')'], true))
319
+                ($next->type !== TokenType::Keyword || !in_array($next->value, ['FROM', 'USING'], true))
320
+                && ($next->type !== TokenType::Operator || !in_array($next->value, [',', ')'], true))
321 321
             ) {
322 322
                 continue;
323 323
             }
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
             $next = $this->list->getNext();
356 356
             if (
357 357
                 ($next->type !== TokenType::Keyword
358
-                    || ! in_array($next->value, self::KEYWORD_NAME_INDICATORS, true)
358
+                    || !in_array($next->value, self::KEYWORD_NAME_INDICATORS, true)
359 359
                 )
360 360
                 && ($next->type !== TokenType::Operator
361
-                    || ! in_array($next->value, self::OPERATOR_NAME_INDICATORS, true)
361
+                    || !in_array($next->value, self::OPERATOR_NAME_INDICATORS, true)
362 362
                 )
363 363
                 && ($next->value !== '')
364 364
             ) {
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     /**
403 403
      * Parses a keyword.
404 404
      */
405
-    public function parseKeyword(): Token|null
405
+    public function parseKeyword(): Token | null
406 406
     {
407 407
         $token = '';
408 408
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
             $token .= $this->str[$this->last];
443 443
             $flags = Context::isKeyword($token);
444 444
 
445
-            if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) {
445
+            if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) {
446 446
                 continue;
447 447
             }
448 448
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
     /**
463 463
      * Parses a label.
464 464
      */
465
-    public function parseLabel(): Token|null
465
+    public function parseLabel(): Token | null
466 466
     {
467 467
         $token = '';
468 468
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
     /**
507 507
      * Parses an operator.
508 508
      */
509
-    public function parseOperator(): Token|null
509
+    public function parseOperator(): Token | null
510 510
     {
511 511
         $token = '';
512 512
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
             $token .= $this->str[$this->last];
527 527
             $flags = Context::isOperator($token);
528 528
 
529
-            if (! $flags) {
529
+            if (!$flags) {
530 530
                 continue;
531 531
             }
532 532
 
@@ -542,11 +542,11 @@  discard block
 block discarded – undo
542 542
     /**
543 543
      * Parses a whitespace.
544 544
      */
545
-    public function parseWhitespace(): Token|null
545
+    public function parseWhitespace(): Token | null
546 546
     {
547 547
         $token = $this->str[$this->last];
548 548
 
549
-        if (! Context::isWhitespace($token)) {
549
+        if (!Context::isWhitespace($token)) {
550 550
             return null;
551 551
         }
552 552
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     /**
563 563
      * Parses a comment.
564 564
      */
565
-    public function parseComment(): Token|null
565
+    public function parseComment(): Token | null
566 566
     {
567 567
         $iBak = $this->last;
568 568
         $token = $this->str[$this->last];
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
     /**
680 680
      * Parses a boolean.
681 681
      */
682
-    public function parseBool(): Token|null
682
+    public function parseBool(): Token | null
683 683
     {
684 684
         if ($this->last + 3 >= $this->len) {
685 685
             // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
     /**
711 711
      * Parses a number.
712 712
      */
713
-    public function parseNumber(): Token|null
713
+    public function parseNumber(): Token | null
714 714
     {
715 715
         // A rudimentary state machine is being used to parse numbers due to
716 716
         // the various forms of their notation.
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
             } elseif ($state === 2) {
778 778
                 $flags |= Token::FLAG_NUMBER_HEX;
779 779
                 if (
780
-                    ! (
780
+                    !(
781 781
                         ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9')
782 782
                         || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F')
783 783
                         || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f')
@@ -873,12 +873,12 @@  discard block
 block discarded – undo
873 873
      *
874 874
      * @throws LexerException
875 875
      */
876
-    public function parseString(string $quote = ''): Token|null
876
+    public function parseString(string $quote = ''): Token | null
877 877
     {
878 878
         $token = $this->str[$this->last];
879 879
         $flags = Context::isString($token);
880 880
 
881
-        if (! $flags && $token !== $quote) {
881
+        if (!$flags && $token !== $quote) {
882 882
             return null;
883 883
         }
884 884
 
@@ -923,12 +923,12 @@  discard block
 block discarded – undo
923 923
      *
924 924
      * @throws LexerException
925 925
      */
926
-    public function parseSymbol(): Token|null
926
+    public function parseSymbol(): Token | null
927 927
     {
928 928
         $token = $this->str[$this->last];
929 929
         $flags = Context::isSymbol($token);
930 930
 
931
-        if (! $flags) {
931
+        if (!$flags) {
932 932
             return null;
933 933
         }
934 934
 
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
             if ($str === null) {
955 955
                 $str = $this->parseUnknown();
956 956
 
957
-                if ($str === null && ! ($flags & Token::FLAG_SYMBOL_PARAMETER)) {
957
+                if ($str === null && !($flags & Token::FLAG_SYMBOL_PARAMETER)) {
958 958
                     $this->error('Variable name was expected.', $this->str[$this->last], $this->last);
959 959
                 }
960 960
             }
@@ -970,14 +970,14 @@  discard block
 block discarded – undo
970 970
     /**
971 971
      * Parses unknown parts of the query.
972 972
      */
973
-    public function parseUnknown(): Token|null
973
+    public function parseUnknown(): Token | null
974 974
     {
975 975
         $token = $this->str[$this->last];
976 976
         if (Context::isSeparator($token)) {
977 977
             return null;
978 978
         }
979 979
 
980
-        while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) {
980
+        while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) {
981 981
             $token .= $this->str[$this->last];
982 982
 
983 983
             // Test if end of token equals the current delimiter. If so, remove it from the token.
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
     /**
997 997
      * Parses the delimiter of the query.
998 998
      */
999
-    public function parseDelimiter(): Token|null
999
+    public function parseDelimiter(): Token | null
1000 1000
     {
1001 1001
         $idx = 0;
1002 1002
 
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
         return new Token($this->delimiter, TokenType::Delimiter);
1014 1014
     }
1015 1015
 
1016
-    private function parse(): Token|null
1016
+    private function parse(): Token | null
1017 1017
     {
1018 1018
         // It is best to put the parsers in order of their complexity
1019 1019
         // (ascending) and their occurrence rate (descending).
Please login to merge, or discard this patch.