Passed
Pull Request — master (#558)
by
unknown
05:06 queued 02:01
created
src/Components/Condition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     public string $rightOperand = '';
33 33
 
34 34
     /** @param string $expr the condition or the operator */
35
-    public function __construct(string|null $expr = null)
35
+    public function __construct(string | null $expr = null)
36 36
     {
37 37
         $this->expr = trim((string) $expr);
38 38
     }
Please login to merge, or discard this patch.
src/Utils/StatementFlags.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
     /**
135 135
      * The type of the statement (which is usually the first keyword).
136 136
      */
137
-    public StatementType|null $queryType = null;
137
+    public StatementType | null $queryType = null;
138 138
 
139 139
     /**
140 140
      * Whether a page reload is required.
Please login to merge, or discard this patch.
src/Utils/StatementInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     public function __construct(
21 21
         public readonly Parser $parser,
22
-        public readonly Statement|null $statement,
22
+        public readonly Statement | null $statement,
23 23
         public readonly StatementFlags $flags,
24 24
         public readonly array $selectTables,
25 25
         public readonly array $selectExpressions,
Please login to merge, or discard this patch.
src/Statement.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @see Statement::$statementOptions
71 71
      */
72
-    public OptionsArray|null $options = null;
72
+    public OptionsArray | null $options = null;
73 73
 
74 74
     /**
75 75
      * The index of the first token used in this statement.
76 76
      */
77
-    public int|null $first = null;
77
+    public int | null $first = null;
78 78
 
79 79
     /**
80 80
      * The index of the last token used in this statement.
81 81
      */
82
-    public int|null $last = null;
82
+    public int | null $last = null;
83 83
 
84 84
     /**
85 85
      * @param Parser|null     $parser the instance that requests parsing
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      *
88 88
      * @throws ParserException
89 89
      */
90
-    public function __construct(Parser|null $parser = null, TokensList|null $list = null)
90
+    public function __construct(Parser | null $parser = null, TokensList | null $list = null)
91 91
     {
92 92
         if (($parser === null) || ($list === null)) {
93 93
             return;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
             // Checking if this field was already built.
134 134
             if ($type & self::ADD_CLAUSE) {
135
-                if (! empty($built[$field])) {
135
+                if (!empty($built[$field])) {
136 136
                     continue;
137 137
                 }
138 138
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             }
146 146
 
147 147
             // Checking if the result of the builder should be added.
148
-            if (! ($type & self::ADD_CLAUSE)) {
148
+            if (!($type & self::ADD_CLAUSE)) {
149 149
                 continue;
150 150
             }
151 151
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                 isset(Parser::STATEMENT_PARSERS[$token->keyword])
279 279
                 && Parser::STATEMENT_PARSERS[$token->keyword] !== ''
280 280
             ) {
281
-                if (static::$clauses !== [] && is_string($token->value) && ! isset(static::$clauses[$token->value])) {
281
+                if (static::$clauses !== [] && is_string($token->value) && !isset(static::$clauses[$token->value])) {
282 282
                     // Some keywords (e.g. `SET`) may be the beginning of a
283 283
                     // statement and a clause.
284 284
                     // If such keyword was found, and it cannot be a clause of
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
                     break;
292 292
                 }
293 293
 
294
-                if (! $parsedOptions) {
295
-                    if (! array_key_exists((string) $token->value, static::$statementOptions)) {
294
+                if (!$parsedOptions) {
295
+                    if (!array_key_exists((string) $token->value, static::$statementOptions)) {
296 296
                         // Skipping keyword because if it is not a option.
297 297
                         ++$list->idx;
298 298
                     }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                     $parsedOptions = true;
302 302
                 }
303 303
             } elseif ($class === null) {
304
-                if (! ($this instanceof SetStatement) || ($token->value !== 'COLLATE' && $token->value !== 'DEFAULT')) {
304
+                if (!($this instanceof SetStatement) || ($token->value !== 'COLLATE' && $token->value !== 'DEFAULT')) {
305 305
                     // There is no parser for this keyword and isn't the beginning
306 306
                     // of a statement (so no options) either.
307 307
                     $parser->error('Unrecognized keyword.', $token);
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
                 if ($minJoin === 0 && $containsJoinClause) {
435 435
                     // First JOIN clause is detected
436 436
                     $minJoin = $maxJoin = $clauseStartIdx;
437
-                } elseif ($minJoin !== 0 && ! $containsJoinClause) {
437
+                } elseif ($minJoin !== 0 && !$containsJoinClause) {
438 438
                     // After a previous JOIN clause, a non-JOIN clause has been detected
439 439
                     $maxJoin = $lastIdx;
440 440
                 } elseif ($maxJoin < $clauseStartIdx && $containsJoinClause) {
Please login to merge, or discard this patch.
src/Statements/SelectStatement.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -249,67 +249,67 @@  discard block
 block discarded – undo
249 249
      *
250 250
      * @var IndexHint[]|null
251 251
      */
252
-    public array|null $indexHints = null;
252
+    public array | null $indexHints = null;
253 253
 
254 254
     /**
255 255
      * Partitions used as source for this statement.
256 256
      */
257
-    public ArrayObj|null $partition = null;
257
+    public ArrayObj | null $partition = null;
258 258
 
259 259
     /**
260 260
      * Conditions used for filtering each row of the result set.
261 261
      *
262 262
      * @var Condition[]|null
263 263
      */
264
-    public array|null $where = null;
264
+    public array | null $where = null;
265 265
 
266 266
     /**
267 267
      * Conditions used for grouping the result set.
268 268
      *
269 269
      * @var GroupKeyword[]|null
270 270
      */
271
-    public array|null $group = null;
271
+    public array | null $group = null;
272 272
 
273 273
     /**
274 274
      * List of options available for the GROUP BY component.
275 275
      */
276
-    public OptionsArray|null $groupOptions = null;
276
+    public OptionsArray | null $groupOptions = null;
277 277
 
278 278
     /**
279 279
      * Conditions used for filtering the result set.
280 280
      *
281 281
      * @var Condition[]|null
282 282
      */
283
-    public array|null $having = null;
283
+    public array | null $having = null;
284 284
 
285 285
     /**
286 286
      * Specifies the order of the rows in the result set.
287 287
      *
288 288
      * @var OrderKeyword[]|null
289 289
      */
290
-    public array|null $order = null;
290
+    public array | null $order = null;
291 291
 
292 292
     /**
293 293
      * Conditions used for limiting the size of the result set.
294 294
      */
295
-    public Limit|null $limit = null;
295
+    public Limit | null $limit = null;
296 296
 
297 297
     /**
298 298
      * Procedure that should process the data in the result set.
299 299
      */
300
-    public FunctionCall|null $procedure = null;
300
+    public FunctionCall | null $procedure = null;
301 301
 
302 302
     /**
303 303
      * Destination of this result set.
304 304
      */
305
-    public IntoKeyword|null $into = null;
305
+    public IntoKeyword | null $into = null;
306 306
 
307 307
     /**
308 308
      * Joins.
309 309
      *
310 310
      * @var JoinKeyword[]|null
311 311
      */
312
-    public array|null $join = null;
312
+    public array | null $join = null;
313 313
 
314 314
     /**
315 315
      * Unions.
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      *
324 324
      * @see SelectStatement::STATEMENT_END_OPTIONS
325 325
      */
326
-    public OptionsArray|null $endOptions = null;
326
+    public OptionsArray | null $endOptions = null;
327 327
 
328 328
     /**
329 329
      * Parses the statements defined by the tokens list.
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
                 isset(Parser::STATEMENT_PARSERS[$token->keyword])
470 470
                 && Parser::STATEMENT_PARSERS[$token->keyword] !== ''
471 471
             ) {
472
-                if (static::$clauses !== [] && is_string($token->value) && ! isset(static::$clauses[$token->value])) {
472
+                if (static::$clauses !== [] && is_string($token->value) && !isset(static::$clauses[$token->value])) {
473 473
                     // Some keywords (e.g. `SET`) may be the beginning of a
474 474
                     // statement and a clause.
475 475
                     // If such keyword was found, and it cannot be a clause of
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
                     break;
483 483
                 }
484 484
 
485
-                if (! $parsedOptions) {
486
-                    if (! array_key_exists((string) $token->value, static::$statementOptions)) {
485
+                if (!$parsedOptions) {
486
+                    if (!array_key_exists((string) $token->value, static::$statementOptions)) {
487 487
                         // Skipping keyword because if it is not a option.
488 488
                         ++$list->idx;
489 489
                     }
@@ -577,28 +577,28 @@  discard block
 block discarded – undo
577 577
         $expressions = $this->from;
578 578
 
579 579
         // Adding expressions from JOIN.
580
-        if (! empty($this->join)) {
580
+        if (!empty($this->join)) {
581 581
             foreach ($this->join as $join) {
582 582
                 $expressions[] = $join->expr;
583 583
             }
584 584
         }
585 585
 
586 586
         foreach ($expressions as $expr) {
587
-            if (! isset($expr->table) || ($expr->table === '')) {
587
+            if (!isset($expr->table) || ($expr->table === '')) {
588 588
                 continue;
589 589
             }
590 590
 
591 591
             $thisDb = isset($expr->database) && ($expr->database !== '') ?
592 592
                 $expr->database : $database;
593 593
 
594
-            if (! isset($retval[$thisDb])) {
594
+            if (!isset($retval[$thisDb])) {
595 595
                 $retval[$thisDb] = [
596 596
                     'alias' => null,
597 597
                     'tables' => [],
598 598
                 ];
599 599
             }
600 600
 
601
-            if (! isset($retval[$thisDb]['tables'][$expr->table])) {
601
+            if (!isset($retval[$thisDb]['tables'][$expr->table])) {
602 602
                 $retval[$thisDb]['tables'][$expr->table] = [
603 603
                     'alias' => isset($expr->alias) && ($expr->alias !== '') ?
604 604
                         $expr->alias : null,
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
                 ];
607 607
             }
608 608
 
609
-            if (! isset($tables[$thisDb])) {
609
+            if (!isset($tables[$thisDb])) {
610 610
                 $tables[$thisDb] = [];
611 611
             }
612 612
 
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
         }
615 615
 
616 616
         foreach ($this->expr as $expr) {
617
-            if (! isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '')) {
617
+            if (!isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '')) {
618 618
                 continue;
619 619
             }
620 620
 
Please login to merge, or discard this patch.
src/Utils/Query.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
             $flags->distinct = true;
81 81
         }
82 82
 
83
-        if (! empty($statement->group) || ! empty($statement->having)) {
83
+        if (!empty($statement->group) || !empty($statement->having)) {
84 84
             $flags->isGroup = true;
85 85
         }
86 86
 
87
-        if (! empty($statement->into) && ($statement->into->type === 'OUTFILE')) {
87
+        if (!empty($statement->into) && ($statement->into->type === 'OUTFILE')) {
88 88
             $flags->isExport = true;
89 89
         }
90 90
 
91 91
         $expressions = $statement->expr;
92
-        if (! empty($statement->join)) {
92
+        if (!empty($statement->join)) {
93 93
             foreach ($statement->join as $join) {
94 94
                 $expressions[] = $join->expr;
95 95
             }
96 96
         }
97 97
 
98 98
         foreach ($expressions as $expr) {
99
-            if (! empty($expr->function)) {
99
+            if (!empty($expr->function)) {
100 100
                 if ($expr->function === 'COUNT') {
101 101
                     $flags->isCount = true;
102 102
                 } elseif (in_array($expr->function, static::$functions)) {
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
             $flags->isSubQuery = true;
112 112
         }
113 113
 
114
-        if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) {
114
+        if (!empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) {
115 115
             $flags->isAnalyse = true;
116 116
         }
117 117
 
118
-        if (! empty($statement->group)) {
118
+        if (!empty($statement->group)) {
119 119
             $flags->group = true;
120 120
         }
121 121
 
122
-        if (! empty($statement->having)) {
122
+        if (!empty($statement->having)) {
123 123
             $flags->having = true;
124 124
         }
125 125
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      *
140 140
      * @param Statement|null $statement the statement to be processed
141 141
      */
142
-    public static function getFlags(Statement|null $statement): StatementFlags
142
+    public static function getFlags(Statement | null $statement): StatementFlags
143 143
     {
144 144
         $flags = new StatementFlags();
145 145
 
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
             || ($statement instanceof UpdateStatement)
216 216
             || ($statement instanceof DeleteStatement)
217 217
         ) {
218
-            if (! empty($statement->limit)) {
218
+            if (!empty($statement->limit)) {
219 219
                 $flags->limit = true;
220 220
             }
221 221
 
222
-            if (! empty($statement->order)) {
222
+            if (!empty($statement->order)) {
223 223
                 $flags->order = true;
224 224
             }
225 225
         }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             // Finding tables' aliases and their associated real names.
250 250
             $tableAliases = [];
251 251
             foreach ($statement->from as $expr) {
252
-                if (! isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) {
252
+                if (!isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) {
253 253
                     continue;
254 254
                 }
255 255
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                         ];
275 275
                     }
276 276
 
277
-                    if (! in_array($arr, $selectTables)) {
277
+                    if (!in_array($arr, $selectTables)) {
278 278
                         $selectTables[] = $arr;
279 279
                     }
280 280
                 } else {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             // extracted from the FROM clause.
288 288
             if ($selectTables === []) {
289 289
                 foreach ($statement->from as $expr) {
290
-                    if (! isset($expr->table) || ($expr->table === '')) {
290
+                    if (!isset($expr->table) || ($expr->table === '')) {
291 291
                         continue;
292 292
                     }
293 293
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement)) {
329 329
             $expressions = [$statement->table];
330 330
         } elseif ($statement instanceof DropStatement) {
331
-            if (! $statement->options->has('TABLE')) {
331
+            if (!$statement->options->has('TABLE')) {
332 332
                 // No tables are dropped.
333 333
                 return [];
334 334
             }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         Statement $statement,
374 374
         TokensList $list,
375 375
         string $clause,
376
-        int|string $type = 0,
376
+        int | string $type = 0,
377 377
         bool $skipFirst = true,
378 378
     ): string {
379 379
         /**
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
 
490 490
             if (
491 491
                 $statement !== '' &&
492
-                ! ctype_space(mb_substr($statement, -1)) &&
493
-                ! ctype_space(mb_substr($part, 0, 1))
492
+                !ctype_space(mb_substr($statement, -1)) &&
493
+                !ctype_space(mb_substr($part, 0, 1))
494 494
             ) {
495 495
                 $statement .= ' ';
496 496
             }
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         Statement $statement,
521 521
         TokensList $list,
522 522
         string $old,
523
-        string|null $new = null,
523
+        string | null $new = null,
524 524
         bool $onlyType = false,
525 525
     ): string {
526 526
         // TODO: Update the tokens list and the statement.
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
      *                                 the remaining part of the query and the last delimiter
594 594
      * @psalm-return array{string|null, string, string|null}
595 595
      */
596
-    public static function getFirstStatement(string $query, string|null $delimiter = null): array
596
+    public static function getFirstStatement(string $query, string | null $delimiter = null): array
597 597
     {
598 598
         $lexer = new Lexer($query, false, $delimiter);
599 599
         $list = $lexer->list;
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 
618 618
             $statement .= $token->token;
619 619
 
620
-            if (($token->type === TokenType::Delimiter) && ! empty($token->token)) {
620
+            if (($token->type === TokenType::Delimiter) && !empty($token->token)) {
621 621
                 $delimiter = $token->token;
622 622
                 $fullStatement = true;
623 623
                 break;
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 
627 627
         // No statement was found so we return the entire query as being the
628 628
         // remaining part.
629
-        if (! $fullStatement) {
629
+        if (!$fullStatement) {
630 630
             return [
631 631
                 null,
632 632
                 $query,
Please login to merge, or discard this patch.