Completed
Push — master ( 25a071...fe490d )
by Maurício
24s queued 20s
created
src/Exceptions/ParserException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      * @param Token  $token the token that produced this exception
25 25
      * @param int    $code  the code of this error
26 26
      */
27
-    public function __construct(string $msg = '', Token|null $token = null, int $code = 0)
27
+    public function __construct(string $msg = '', Token | null $token = null, int $code = 0)
28 28
     {
29 29
         parent::__construct($msg, $code);
30 30
         $this->token = $token;
Please login to merge, or discard this patch.
src/Utils/Formatter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                 // The options of a clause should stay on the same line and everything that follows.
436 436
                 if (
437 437
                     $this->options['parts_newline']
438
-                    && ! $formattedOptions
438
+                    && !$formattedOptions
439 439
                     && empty(self::$inlineClauses[$lastClause])
440 440
                     && (
441 441
                         $curr->type !== TokenType::Keyword
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                         end($blocksLineEndings) === true
493 493
                         || (
494 494
                             empty(self::$inlineClauses[$lastClause])
495
-                            && ! $shortGroup
495
+                            && !$shortGroup
496 496
                             && $this->options['parts_newline']
497 497
                         )
498 498
                     ) {
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                     $lineEnded = false;
529 529
                 } elseif (
530 530
                     $prev->keyword === 'DELIMITER'
531
-                    || ! (
531
+                    || !(
532 532
                     ($prev->type === TokenType::Operator && ($prev->value === '.' || $prev->value === '('))
533 533
                     // No space after . (
534 534
                     || ($curr->type === TokenType::Operator
@@ -643,13 +643,13 @@  discard block
 block discarded – undo
643 643
 
644 644
         foreach ($this->options['formats'] as $format) {
645 645
             if (
646
-                $token->type->value !== $format['type'] || ! (($token->flags & $format['flags']) === $format['flags'])
646
+                $token->type->value !== $format['type'] || !(($token->flags & $format['flags']) === $format['flags'])
647 647
             ) {
648 648
                 continue;
649 649
             }
650 650
 
651 651
             // Running transformation function.
652
-            if (! empty($format['function'])) {
652
+            if (!empty($format['function'])) {
653 653
                 $func = $format['function'];
654 654
                 $text = $func($text);
655 655
             }
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      *
759 759
      * @psalm-return 1|2|false
760 760
      */
761
-    public static function isClause(Token $token): int|false
761
+    public static function isClause(Token $token): int | false
762 762
     {
763 763
         if (
764 764
             ($token->type === TokenType::Keyword && isset(Parser::STATEMENT_PARSERS[$token->keyword]))
Please login to merge, or discard this patch.
src/Utils/BufferedQuery.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      *
120 120
      * @param bool $end whether the end of the buffer was reached
121 121
      */
122
-    public function extract(bool $end = false): string|false
122
+    public function extract(bool $end = false): string | false
123 123
     {
124 124
         /**
125 125
          * The last parsed position.
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 
312 312
                 // Parsing the delimiter.
313 313
                 $delimiter = '';
314
-                while (($i < $len) && (! Context::isWhitespace($this->query[$i]))) {
314
+                while (($i < $len) && (!Context::isWhitespace($this->query[$i]))) {
315 315
                     $delimiter .= $this->query[$i++];
316 316
                 }
317 317
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
                     // Whether this statement should be returned or not.
328 328
                     $ret = '';
329
-                    if (! empty($this->options['parse_delimiter'])) {
329
+                    if (!empty($this->options['parse_delimiter'])) {
330 330
                         // Appending the `DELIMITER` statement that was just
331 331
                         // found to the current statement.
332 332
                         $ret = trim(
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
                 $ret = $this->current;
370 370
 
371 371
                 // If needed, adds a delimiter at the end of the statement.
372
-                if (! empty($this->options['add_delimiter'])) {
372
+                if (!empty($this->options['add_delimiter'])) {
373 373
                     $ret .= $this->delimiter;
374 374
                 }
375 375
 
Please login to merge, or discard this patch.
src/Utils/CLI.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         foreach ($longopts as $value) {
38 38
             $value = rtrim($value, ':');
39
-            if (! isset($params[$value])) {
39
+            if (!isset($params[$value])) {
40 40
                 continue;
41 41
             }
42 42
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return string[]|false[]|false
57 57
      */
58
-    public function getopt(string $opt, array $long): array|false
58
+    public function getopt(string $opt, array $long): array | false
59 59
     {
60 60
         return getopt($opt, $long);
61 61
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     /**
64 64
      * @return string[]|false[]|false
65 65
      */
66
-    public function parseHighlight(): array|false
66
+    public function parseHighlight(): array | false
67 67
     {
68 68
         $longopts = [
69 69
             'help',
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         $this->mergeLongOpts($params, $longopts);
80
-        if (! isset($params['f'])) {
80
+        if (!isset($params['f'])) {
81 81
             $params['f'] = 'cli';
82 82
         }
83 83
 
84
-        if (! in_array($params['f'], ['html', 'cli', 'text'])) {
84
+        if (!in_array($params['f'], ['html', 'cli', 'text'])) {
85 85
             echo "ERROR: Invalid value for format!\n";
86 86
 
87 87
             return false;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             return 0;
104 104
         }
105 105
 
106
-        if (! isset($params['q'])) {
106
+        if (!isset($params['q'])) {
107 107
             $stdIn = $this->readStdin();
108 108
 
109 109
             if ($stdIn) {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     /**
141 141
      * @return string[]|false[]|false
142 142
      */
143
-    public function parseLint(): array|false
143
+    public function parseLint(): array | false
144 144
     {
145 145
         $longopts = [
146 146
             'help',
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             Context::load($params['c']);
172 172
         }
173 173
 
174
-        if (! isset($params['q'])) {
174
+        if (!isset($params['q'])) {
175 175
             $stdIn = $this->readStdin();
176 176
 
177 177
             if ($stdIn) {
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     /**
214 214
      * @return string[]|false[]|false
215 215
      */
216
-    public function parseTokenize(): array|false
216
+    public function parseTokenize(): array | false
217 217
     {
218 218
         $longopts = [
219 219
             'help',
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             return 0;
240 240
         }
241 241
 
242
-        if (! isset($params['q'])) {
242
+        if (!isset($params['q'])) {
243 243
             $stdIn = $this->readStdin();
244 244
 
245 245
             if ($stdIn) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         return 1;
276 276
     }
277 277
 
278
-    public function readStdin(): string|false|null
278
+    public function readStdin(): string | false | null
279 279
     {
280 280
         $read = [STDIN];
281 281
         $write = [];
Please login to merge, or discard this patch.
src/Utils/Query.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -299,23 +299,23 @@  discard block
 block discarded – undo
299 299
             $flags['distinct'] = true;
300 300
         }
301 301
 
302
-        if (! empty($statement->group) || ! empty($statement->having)) {
302
+        if (!empty($statement->group) || !empty($statement->having)) {
303 303
             $flags['is_group'] = true;
304 304
         }
305 305
 
306
-        if (! empty($statement->into) && ($statement->into->type === 'OUTFILE')) {
306
+        if (!empty($statement->into) && ($statement->into->type === 'OUTFILE')) {
307 307
             $flags['is_export'] = true;
308 308
         }
309 309
 
310 310
         $expressions = $statement->expr;
311
-        if (! empty($statement->join)) {
311
+        if (!empty($statement->join)) {
312 312
             foreach ($statement->join as $join) {
313 313
                 $expressions[] = $join->expr;
314 314
             }
315 315
         }
316 316
 
317 317
         foreach ($expressions as $expr) {
318
-            if (! empty($expr->function)) {
318
+            if (!empty($expr->function)) {
319 319
                 if ($expr->function === 'COUNT') {
320 320
                     $flags['is_count'] = true;
321 321
                 } elseif (in_array($expr->function, static::$functions)) {
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
             $flags['is_subquery'] = true;
331 331
         }
332 332
 
333
-        if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) {
333
+        if (!empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) {
334 334
             $flags['is_analyse'] = true;
335 335
         }
336 336
 
337
-        if (! empty($statement->group)) {
337
+        if (!empty($statement->group)) {
338 338
             $flags['group'] = true;
339 339
         }
340 340
 
341
-        if (! empty($statement->having)) {
341
+        if (!empty($statement->having)) {
342 342
             $flags['having'] = true;
343 343
         }
344 344
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             $flags['union'] = true;
347 347
         }
348 348
 
349
-        if (! empty($statement->join)) {
349
+        if (!empty($statement->join)) {
350 350
             $flags['join'] = true;
351 351
         }
352 352
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      * @return array<string, bool|string>
363 363
      * @psalm-return QueryFlagsType
364 364
      */
365
-    public static function getFlags(Statement|null $statement, bool $all = false): array
365
+    public static function getFlags(Statement | null $statement, bool $all = false): array
366 366
     {
367 367
         $flags = ['querytype' => false];
368 368
         if ($all) {
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
             || ($statement instanceof UpdateStatement)
438 438
             || ($statement instanceof DeleteStatement)
439 439
         ) {
440
-            if (! empty($statement->limit)) {
440
+            if (!empty($statement->limit)) {
441 441
                 $flags['limit'] = true;
442 442
             }
443 443
 
444
-            if (! empty($statement->order)) {
444
+            if (!empty($statement->order)) {
445 445
                 $flags['order'] = true;
446 446
             }
447 447
         }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
             // Finding tables' aliases and their associated real names.
492 492
             $tableAliases = [];
493 493
             foreach ($statement->from as $expr) {
494
-                if (! isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) {
494
+                if (!isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) {
495 495
                     continue;
496 496
                 }
497 497
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                         ];
517 517
                     }
518 518
 
519
-                    if (! in_array($arr, $ret['select_tables'])) {
519
+                    if (!in_array($arr, $ret['select_tables'])) {
520 520
                         $ret['select_tables'][] = $arr;
521 521
                     }
522 522
                 } else {
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
             // extracted from the FROM clause.
530 530
             if ($ret['select_tables'] === []) {
531 531
                 foreach ($statement->from as $expr) {
532
-                    if (! isset($expr->table) || ($expr->table === '')) {
532
+                    if (!isset($expr->table) || ($expr->table === '')) {
533 533
                         continue;
534 534
                     }
535 535
 
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
         } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement)) {
571 571
             $expressions = [$statement->table];
572 572
         } elseif ($statement instanceof DropStatement) {
573
-            if (! $statement->options->has('TABLE')) {
573
+            if (!$statement->options->has('TABLE')) {
574 574
                 // No tables are dropped.
575 575
                 return [];
576 576
             }
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
         Statement $statement,
616 616
         TokensList $list,
617 617
         string $clause,
618
-        int|string $type = 0,
618
+        int | string $type = 0,
619 619
         bool $skipFirst = true
620 620
     ): string {
621 621
         /**
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
         Statement $statement,
748 748
         TokensList $list,
749 749
         string $old,
750
-        string|null $new = null,
750
+        string | null $new = null,
751 751
         bool $onlyType = false
752 752
     ): string {
753 753
         // TODO: Update the tokens list and the statement.
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
      *                                 the remaining part of the query and the last delimiter
827 827
      * @psalm-return array{string|null, string, string|null}
828 828
      */
829
-    public static function getFirstStatement(string $query, string|null $delimiter = null): array
829
+    public static function getFirstStatement(string $query, string | null $delimiter = null): array
830 830
     {
831 831
         $lexer = new Lexer($query, false, $delimiter);
832 832
         $list = $lexer->list;
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 
855 855
             $statement .= $token->token;
856 856
 
857
-            if (($token->type === TokenType::Delimiter) && ! empty($token->token)) {
857
+            if (($token->type === TokenType::Delimiter) && !empty($token->token)) {
858 858
                 $delimiter = $token->token;
859 859
                 $fullStatement = true;
860 860
                 break;
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 
864 864
         // No statement was found so we return the entire query as being the
865 865
         // remaining part.
866
-        if (! $fullStatement) {
866
+        if (!$fullStatement) {
867 867
             return [
868 868
                 null,
869 869
                 $query,
Please login to merge, or discard this patch.
src/Utils/Table.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public static function getForeignKeys(CreateStatement $statement): array
32 32
     {
33
-        if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) {
33
+        if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) {
34 34
             return [];
35 35
         }
36 36
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
             $columns = [];
45 45
             foreach ($field->key->columns as $column) {
46
-                if (! isset($column['name'])) {
46
+                if (!isset($column['name'])) {
47 47
                     continue;
48 48
                 }
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 'index_list' => $columns,
56 56
             ];
57 57
 
58
-            if (! empty($field->references)) {
58
+            if (!empty($field->references)) {
59 59
                 $tmp['ref_db_name'] = $field->references->table->database;
60 60
                 $tmp['ref_table_name'] = $field->references->table->table;
61 61
                 $tmp['ref_index_list'] = $field->references->columns;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public static function getFields(CreateStatement $statement): array
98 98
     {
99
-        if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) {
99
+        if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) {
100 100
             return [];
101 101
         }
102 102
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 'timestamp_not_null' => false,
114 114
             ];
115 115
 
116
-            if (! $field->options) {
116
+            if (!$field->options) {
117 117
                 continue;
118 118
             }
119 119
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
             $option = $field->options->has('AS');
142 142
 
143
-            if (! $option) {
143
+            if (!$option) {
144 144
                 continue;
145 145
             }
146 146
 
Please login to merge, or discard this patch.
src/Components/Limit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param int|string $rowCount the row count
34 34
      * @param int|string $offset   the offset
35 35
      */
36
-    public function __construct(int|string $rowCount = 0, int|string $offset = 0)
36
+    public function __construct(int | string $rowCount = 0, int | string $offset = 0)
37 37
     {
38 38
         $this->rowCount = $rowCount;
39 39
         $this->offset = $offset;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
             // Skip if not a number or a bind parameter (?)
89 89
             if (
90
-                ! ($token->type === TokenType::Number
90
+                !($token->type === TokenType::Number
91 91
                     || ($token->type === TokenType::Symbol && ($token->flags & Token::FLAG_SYMBOL_PARAMETER)))
92 92
             ) {
93 93
                 break;
Please login to merge, or discard this patch.
src/Components/FunctionCall.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * @param string|null            $name       the name of the function to be called
35 35
      * @param string[]|ArrayObj|null $parameters the parameters of this function
36 36
      */
37
-    public function __construct(string|null $name = null, array|ArrayObj|null $parameters = null)
37
+    public function __construct(string | null $name = null, array | ArrayObj | null $parameters = null)
38 38
     {
39 39
         $this->name = $name;
40 40
         if (is_array($parameters)) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 if ($token->type === TokenType::Operator && $token->value === '(') {
88 88
                     --$list->idx; // ArrayObj needs to start with `(`
89 89
                     $state = 1;
90
-                    continue;// do not add this token to the name
90
+                    continue; // do not add this token to the name
91 91
                 }
92 92
 
93 93
                 $ret->name .= $token->value;
Please login to merge, or discard this patch.
src/Components/RenameOperation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * @param Expression $old old expression
35 35
      * @param Expression $new new expression containing new name
36 36
      */
37
-    public function __construct(Expression|null $old = null, Expression|null $new = null)
37
+    public function __construct(Expression | null $old = null, Expression | null $new = null)
38 38
     {
39 39
         $this->old = $old;
40 40
         $this->new = $new;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         }
139 139
 
140 140
         // Last iteration was not saved.
141
-        if (! empty($expr->old)) {
141
+        if (!empty($expr->old)) {
142 142
             $ret[] = $expr;
143 143
         }
144 144
 
Please login to merge, or discard this patch.