Passed
Pull Request — master (#535)
by
unknown
02:55
created
src/Components/Key.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
      * @phpstan-param array{name?: string, length?: int, order?: string}[] $columns
106 106
      */
107 107
     public function __construct(
108
-        string|null $name = null,
108
+        string | null $name = null,
109 109
         array $columns = [],
110
-        string|null $type = null,
111
-        OptionsArray|null $options = null,
110
+        string | null $type = null,
111
+        OptionsArray | null $options = null,
112 112
     ) {
113 113
         $this->name = $name;
114 114
         $this->columns = $columns;
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
             } elseif ($state === 1) {
175 175
                 if (($token->type === TokenType::Operator) && ($token->value === '(')) {
176 176
                     $positionBeforeSearch = $list->idx;
177
-                    $list->idx++;// Ignore the current token "(" or the search condition will always be true
177
+                    $list->idx++; // Ignore the current token "(" or the search condition will always be true
178 178
                     $nextToken = $list->getNext();
179
-                    $list->idx = $positionBeforeSearch;// Restore the position
179
+                    $list->idx = $positionBeforeSearch; // Restore the position
180 180
 
181 181
                     if ($nextToken !== null && $nextToken->value === '(') {
182 182
                         // Switch to expression mode
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                 if ($token->type === TokenType::Operator) {
226 226
                     // This got back to here and we reached the end of the expression
227 227
                     if ($token->value === ')') {
228
-                        $state = 4;// go back to state 4 to fetch options
228
+                        $state = 4; // go back to state 4 to fetch options
229 229
                         continue;
230 230
                     }
231 231
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     public function build(): string
262 262
     {
263 263
         $ret = $this->type . ' ';
264
-        if (! empty($this->name)) {
264
+        if (!empty($this->name)) {
265 265
             $ret .= Context::escape($this->name) . ' ';
266 266
         }
267 267
 
Please login to merge, or discard this patch.
src/Components/PartitionDefinition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@
 block discarded – undo
231 231
         return trim(
232 232
             'PARTITION ' . $this->name
233 233
             . (empty($this->type) ? '' : ' VALUES ' . $this->type . ' ' . $this->expr . ' ')
234
-            . (! empty($this->options) && ! empty($this->type) ? '' : ' ')
234
+            . (!empty($this->options) && !empty($this->type) ? '' : ' ')
235 235
             . $this->options . $subpartitions,
236 236
         );
237 237
     }
Please login to merge, or discard this patch.
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/Exceptions/ParserException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@
 block discarded – undo
15 15
     /**
16 16
      * The token that produced this error.
17 17
      */
18
-    public Token|null $token;
18
+    public Token | null $token;
19 19
 
20 20
     /**
21 21
      * @param string     $msg   the message of this exception
22 22
      * @param Token|null $token the token that produced this exception
23 23
      * @param int        $code  the code of this error
24 24
      */
25
-    public function __construct(string $msg, Token|null $token, int $code = 0)
25
+    public function __construct(string $msg, Token | null $token, int $code = 0)
26 26
     {
27 27
         parent::__construct($msg, $code);
28 28
 
Please login to merge, or discard this patch.
src/Utils/BufferedQuery.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * The current status of the parser.
64 64
      */
65
-    public int|null $status = null;
65
+    public int | null $status = null;
66 66
 
67 67
     /**
68 68
      * The last incomplete query that was extracted.
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @param bool $end whether the end of the buffer was reached
111 111
      */
112
-    public function extract(bool $end = false): string|false
112
+    public function extract(bool $end = false): string | false
113 113
     {
114 114
         /**
115 115
          * The last parsed position.
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
                 // Parsing the delimiter.
303 303
                 $delimiter = '';
304
-                while (($i < $len) && (! Context::isWhitespace($this->query[$i]))) {
304
+                while (($i < $len) && (!Context::isWhitespace($this->query[$i]))) {
305 305
                     $delimiter .= $this->query[$i++];
306 306
                 }
307 307
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
                     // Whether this statement should be returned or not.
318 318
                     $ret = '';
319
-                    if (! empty($this->options['parse_delimiter'])) {
319
+                    if (!empty($this->options['parse_delimiter'])) {
320 320
                         // Appending the `DELIMITER` statement that was just
321 321
                         // found to the current statement.
322 322
                         $ret = trim(
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
                 $ret = $this->current;
360 360
 
361 361
                 // If needed, adds a delimiter at the end of the statement.
362
-                if (! empty($this->options['add_delimiter'])) {
362
+                if (!empty($this->options['add_delimiter'])) {
363 363
                     $ret .= $this->delimiter;
364 364
                 }
365 365
 
Please login to merge, or discard this patch.
src/Parser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     /**
356 356
      * The list of tokens that are parsed.
357 357
      */
358
-    public TokensList|null $list = null;
358
+    public TokensList | null $list = null;
359 359
 
360 360
     /**
361 361
      * List of statements parsed.
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
      * @param string|UtfString|TokensList|null $list   the list of tokens to be parsed
374 374
      * @param bool                             $strict whether strict mode should be enabled or not
375 375
      */
376
-    public function __construct(string|UtfString|TokensList|null $list = null, bool $strict = false)
376
+    public function __construct(string | UtfString | TokensList | null $list = null, bool $strict = false)
377 377
     {
378 378
         if (Context::$keywords === []) {
379 379
             Context::load();
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
                 $list->idx = $lastIdx;
504 504
             } elseif (empty(self::STATEMENT_PARSERS[$token->keyword])) {
505 505
                 // Checking if it is a known statement that can be parsed.
506
-                if (! isset(self::STATEMENT_PARSERS[$token->keyword])) {
506
+                if (!isset(self::STATEMENT_PARSERS[$token->keyword])) {
507 507
                     // A statement is considered recognized if the parser
508 508
                     // is aware that it is a statement, but it does not have
509 509
                     // a parser for it yet.
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 
544 544
             // Handles unions.
545 545
             if (
546
-                ! empty($unionType)
546
+                !empty($unionType)
547 547
                 && ($lastStatement instanceof SelectStatement)
548 548
                 && ($statement instanceof SelectStatement)
549 549
             ) {
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
      *
631 631
      * @throws ParserException throws the exception, if strict mode is enabled.
632 632
      */
633
-    public function error(string $msg, Token|null $token = null, int $code = 0): void
633
+    public function error(string $msg, Token | null $token = null, int $code = 0): void
634 634
     {
635 635
         $error = new ParserException(
636 636
             Translator::gettext($msg),
Please login to merge, or discard this patch.
src/Translator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function load(): void
31 31
     {
32
-        if (! isset(self::$loader)) {
32
+        if (!isset(self::$loader)) {
33 33
             // Create loader object
34 34
             self::$loader = new Loader();
35 35
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public static function gettext(string $msgid): string
64 64
     {
65
-        if (! class_exists(Loader::class, true)) {
65
+        if (!class_exists(Loader::class, true)) {
66 66
             return $msgid;
67 67
         }
68 68
 
Please login to merge, or discard this patch.
src/Statements/UpdateStatement.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -99,38 +99,38 @@
 block discarded – undo
99 99
      *
100 100
      * @var Expression[]|null
101 101
      */
102
-    public array|null $tables = null;
102
+    public array | null $tables = null;
103 103
 
104 104
     /**
105 105
      * The updated values.
106 106
      *
107 107
      * @var SetOperation[]|null
108 108
      */
109
-    public array|null $set = null;
109
+    public array | null $set = null;
110 110
 
111 111
     /**
112 112
      * Conditions used for filtering each row of the result set.
113 113
      *
114 114
      * @var Condition[]|null
115 115
      */
116
-    public array|null $where = null;
116
+    public array | null $where = null;
117 117
 
118 118
     /**
119 119
      * Specifies the order of the rows in the result set.
120 120
      *
121 121
      * @var OrderKeyword[]|null
122 122
      */
123
-    public array|null $order = null;
123
+    public array | null $order = null;
124 124
 
125 125
     /**
126 126
      * Conditions used for limiting the size of the result set.
127 127
      */
128
-    public Limit|null $limit = null;
128
+    public Limit | null $limit = null;
129 129
 
130 130
     /**
131 131
      * Joins.
132 132
      *
133 133
      * @var JoinKeyword[]|null
134 134
      */
135
-    public array|null $join = null;
135
+    public array | null $join = null;
136 136
 }
Please login to merge, or discard this patch.