Passed
Push — master ( de2d27...d28f1e )
by Maurício
10:00 queued 06:30
created
src/Parsers/GroupKeywords.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 ) {
89 89
                     $expr->type = $token->keyword;
90 90
                 } elseif (($token->type === TokenType::Operator) && ($token->value === ',')) {
91
-                    if (! empty($expr->expr)) {
91
+                    if (!empty($expr->expr)) {
92 92
                         $ret[] = $expr;
93 93
                     }
94 94
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
 
103 103
         // Last iteration was not processed.
104
-        if (! empty($expr->expr)) {
104
+        if (!empty($expr->expr)) {
105 105
             $ret[] = $expr;
106 106
         }
107 107
 
Please login to merge, or discard this patch.
src/Parsers/Expressions.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @throws ParserException
82 82
      */
83
-    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null
83
+    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null
84 84
     {
85 85
         $ret = new Expression();
86 86
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         ];
114 114
 
115 115
         // When a field is parsed, no parentheses are expected.
116
-        if (! empty($options['parseField'])) {
116
+        if (!empty($options['parseField'])) {
117 117
             $options['breakOnParentheses'] = true;
118 118
             $options['field'] = $options['parseField'];
119 119
         }
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
             }
141 141
 
142 142
             if ($token->type === TokenType::Keyword) {
143
-                if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
143
+                if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
144 144
                     // A `(` was previously found and this keyword is the
145 145
                     // beginning of a statement, so this is a subquery.
146 146
                     $ret->subquery = $token->keyword;
147 147
                 } elseif (
148 148
                     ($token->flags & Token::FLAG_KEYWORD_FUNCTION)
149 149
                     && (empty($options['parseField'])
150
-                    && ! $alias)
150
+                    && !$alias)
151 151
                 ) {
152 152
                     $isExpr = true;
153 153
                 } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) {
154
-                    if (! in_array($token->keyword, self::ALLOWED_KEYWORDS, true)) {
154
+                    if (!in_array($token->keyword, self::ALLOWED_KEYWORDS, true)) {
155 155
                         // A reserved keyword that is not allowed in the
156 156
                         // expression was found so the expression must have
157 157
                         // ended and a new clause is starting.
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                     }
160 160
 
161 161
                     if ($token->keyword === 'AS') {
162
-                        if (! empty($options['breakOnAlias'])) {
162
+                        if (!empty($options['breakOnAlias'])) {
163 163
                             break;
164 164
                         }
165 165
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
                     $isExpr = true;
185 185
                 } elseif (
186
-                    $brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias
186
+                    $brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias
187 187
                     && ($ret->table === null || $ret->table === '')
188 188
                 ) {
189 189
                     /* End of expression */
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                 || (($token->type === TokenType::Operator)
202 202
                 && ($token->value !== '.'))
203 203
             ) {
204
-                if (! empty($options['parseField'])) {
204
+                if (!empty($options['parseField'])) {
205 205
                     break;
206 206
                 }
207 207
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             }
212 212
 
213 213
             if ($token->type === TokenType::Operator) {
214
-                if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
214
+                if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
215 215
                     // No brackets were expected.
216 216
                     break;
217 217
                 }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
                     --$brackets;
237 237
                     if ($brackets === 0) {
238
-                        if (! empty($options['parenthesesDelimited'])) {
238
+                        if (!empty($options['parenthesesDelimited'])) {
239 239
                             // The current token is the last bracket, the next
240 240
                             // one will be outside the expression.
241 241
                             $ret->expr .= $token->token;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
             if ($alias) {
263 263
                 // An alias is expected (the keyword `AS` was previously found).
264
-                if (! empty($ret->alias)) {
264
+                if (!empty($ret->alias)) {
265 265
                     $parser->error('An alias was previously found.', $token);
266 266
                     break;
267 267
                 }
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
                     && ($prev[0] === null
276 276
                         || (($prev[0]->type !== TokenType::Operator || $prev[0]->token === ')')
277 277
                             && ($prev[0]->type !== TokenType::Keyword
278
-                                || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
278
+                                || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
279 279
                     && (($prev[1]->type === TokenType::String)
280 280
                         || ($prev[1]->type === TokenType::Symbol
281
-                            && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)
282
-                            && ! ($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER))
281
+                            && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)
282
+                            && !($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER))
283 283
                         || ($prev[1]->type === TokenType::None
284 284
                             && $prev[1]->token !== 'OVER'))
285 285
                 ) {
286
-                    if (! empty($ret->alias)) {
286
+                    if (!empty($ret->alias)) {
287 287
                         $parser->error('An alias was previously found.', $token);
288 288
                         break;
289 289
                     }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
                     // Found a `.` which means we expect a column name and
315 315
                     // the column name we parsed is actually the table name
316 316
                     // and the table name is actually a database name.
317
-                    if (! empty($ret->database) || $dot) {
317
+                    if (!empty($ret->database) || $dot) {
318 318
                         $parser->error('Unexpected dot.', $token);
319 319
                     }
320 320
 
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
                         $dot = false;
332 332
                     } else {
333 333
                         // No alias is expected.
334
-                        if (! empty($options['breakOnAlias'])) {
334
+                        if (!empty($options['breakOnAlias'])) {
335 335
                             break;
336 336
                         }
337 337
 
338
-                        if (! empty($ret->alias)) {
338
+                        if (!empty($ret->alias)) {
339 339
                             $parser->error('An alias was previously found.', $token);
340 340
                             break;
341 341
                         }
Please login to merge, or discard this patch.
src/Parsers/OrderKeywords.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 ) {
89 89
                     $expr->type = $token->keyword;
90 90
                 } elseif (($token->type === TokenType::Operator) && ($token->value === ',')) {
91
-                    if (! empty($expr->expr)) {
91
+                    if (!empty($expr->expr)) {
92 92
                         $ret[] = $expr;
93 93
                     }
94 94
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
 
103 103
         // Last iteration was not processed.
104
-        if (! empty($expr->expr)) {
104
+        if (!empty($expr->expr)) {
105 105
             $ret[] = $expr;
106 106
         }
107 107
 
Please login to merge, or discard this patch.
src/Parsers/Limits.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 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/Parsers/Keys.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
             } elseif ($state === 1) {
113 113
                 if (($token->type === TokenType::Operator) && ($token->value === '(')) {
114 114
                     $positionBeforeSearch = $list->idx;
115
-                    $list->idx++;// Ignore the current token "(" or the search condition will always be true
115
+                    $list->idx++; // Ignore the current token "(" or the search condition will always be true
116 116
                     $nextToken = $list->getNext();
117
-                    $list->idx = $positionBeforeSearch;// Restore the position
117
+                    $list->idx = $positionBeforeSearch; // Restore the position
118 118
 
119 119
                     if ($nextToken !== null && $nextToken->value === '(') {
120 120
                         // Switch to expression mode
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                 if ($token->type === TokenType::Operator) {
164 164
                     // This got back to here and we reached the end of the expression
165 165
                     if ($token->value === ')') {
166
-                        $state = 4;// go back to state 4 to fetch options
166
+                        $state = 4; // go back to state 4 to fetch options
167 167
                         continue;
168 168
                     }
169 169
 
Please login to merge, or discard this patch.
src/Components/OptionsArray.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 
34 34
         $options = [];
35 35
         foreach ($this->options as $option) {
36
-            if (! is_array($option)) {
36
+            if (!is_array($option)) {
37 37
                 $options[] = $option;
38 38
             } else {
39 39
                 $options[] = $option['name']
40
-                    . (! empty($option['equals']) ? '=' : ' ')
41
-                    . (! empty($option['expr']) ? $option['expr'] : $option['value']);
40
+                    . (!empty($option['equals']) ? '=' : ' ')
41
+                    . (!empty($option['expr']) ? $option['expr'] : $option['value']);
42 42
             }
43 43
         }
44 44
 
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
     {
57 57
         foreach ($this->options as $option) {
58 58
             if (is_array($option)) {
59
-                if (! strcasecmp($key, $option['name'])) {
59
+                if (!strcasecmp($key, $option['name'])) {
60 60
                     return $getExpr ? $option['expr'] : $option['value'];
61 61
                 }
62
-            } elseif (! strcasecmp($key, $option)) {
62
+            } elseif (!strcasecmp($key, $option)) {
63 63
                 return true;
64 64
             }
65 65
         }
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
     {
79 79
         foreach ($this->options as $idx => $option) {
80 80
             if (is_array($option)) {
81
-                if (! strcasecmp($key, $option['name'])) {
81
+                if (!strcasecmp($key, $option['name'])) {
82 82
                     unset($this->options[$idx]);
83 83
 
84 84
                     return true;
85 85
                 }
86
-            } elseif (! strcasecmp($key, $option)) {
86
+            } elseif (!strcasecmp($key, $option)) {
87 87
                 unset($this->options[$idx]);
88 88
 
89 89
                 return true;
Please login to merge, or discard this patch.
src/Statements/CreateStatement.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
      *
277 277
      * Used by all `CREATE` statements.
278 278
      */
279
-    public Expression|null $name = null;
279
+    public Expression | null $name = null;
280 280
 
281 281
     /**
282 282
      * The options of the entity (table, procedure, function, etc.).
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      * @see CreateStatement::FUNCTION_OPTIONS
288 288
      * @see CreateStatement::TRIGGER_OPTIONS
289 289
      */
290
-    public OptionsArray|null $entityOptions = null;
290
+    public OptionsArray | null $entityOptions = null;
291 291
 
292 292
     /**
293 293
      * If `CREATE TABLE`, a list of columns and keys.
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      *
298 298
      * @var CreateDefinition[]|ArrayObj|null
299 299
      */
300
-    public array|ArrayObj|null $fields = null;
300
+    public array | ArrayObj | null $fields = null;
301 301
 
302 302
     /**
303 303
      * If `CREATE TABLE WITH`.
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      *
307 307
      * Used by `CREATE TABLE`, `CREATE VIEW`
308 308
      */
309
-    public WithStatement|null $with = null;
309
+    public WithStatement | null $with = null;
310 310
 
311 311
     /**
312 312
      * If `CREATE TABLE ... SELECT`.
@@ -314,55 +314,55 @@  discard block
 block discarded – undo
314 314
      *
315 315
      * Used by `CREATE TABLE`, `CREATE VIEW`
316 316
      */
317
-    public SelectStatement|null $select = null;
317
+    public SelectStatement | null $select = null;
318 318
 
319 319
     /**
320 320
      * If `CREATE TABLE ... LIKE`.
321 321
      *
322 322
      * Used by `CREATE TABLE`
323 323
      */
324
-    public Expression|null $like = null;
324
+    public Expression | null $like = null;
325 325
 
326 326
     /**
327 327
      * Expression used for partitioning.
328 328
      */
329
-    public string|null $partitionBy = null;
329
+    public string | null $partitionBy = null;
330 330
 
331 331
     /**
332 332
      * The number of partitions.
333 333
      */
334
-    public int|null $partitionsNum = null;
334
+    public int | null $partitionsNum = null;
335 335
 
336 336
     /**
337 337
      * Expression used for subpartitioning.
338 338
      */
339
-    public string|null $subpartitionBy = null;
339
+    public string | null $subpartitionBy = null;
340 340
 
341 341
     /**
342 342
      * The number of subpartitions.
343 343
      */
344
-    public int|null $subpartitionsNum = null;
344
+    public int | null $subpartitionsNum = null;
345 345
 
346 346
     /**
347 347
      * The partition of the new table.
348 348
      *
349 349
      * @var PartitionDefinition[]|null
350 350
      */
351
-    public array|null $partitions = null;
351
+    public array | null $partitions = null;
352 352
 
353 353
     /**
354 354
      * If `CREATE TRIGGER` the name of the table.
355 355
      *
356 356
      * Used by `CREATE TRIGGER`.
357 357
      */
358
-    public Expression|null $table = null;
358
+    public Expression | null $table = null;
359 359
 
360 360
     /**
361 361
      * The return data type of this routine.
362 362
      *
363 363
      * Used by `CREATE FUNCTION`.
364 364
      */
365
-    public DataType|null $return = null;
365
+    public DataType | null $return = null;
366 366
 
367 367
     /**
368 368
      * The parameters of this routine.
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
      *
372 372
      * @var ParameterDefinition[]|null
373 373
      */
374
-    public array|null $parameters = null;
374
+    public array | null $parameters = null;
375 375
 
376 376
     /**
377 377
      * The body of this function or procedure.
@@ -424,23 +424,23 @@  discard block
 block discarded – undo
424 424
 
425 425
             $partition = '';
426 426
 
427
-            if (! empty($this->partitionBy)) {
427
+            if (!empty($this->partitionBy)) {
428 428
                 $partition .= "\nPARTITION BY " . $this->partitionBy;
429 429
             }
430 430
 
431
-            if (! empty($this->partitionsNum)) {
431
+            if (!empty($this->partitionsNum)) {
432 432
                 $partition .= "\nPARTITIONS " . $this->partitionsNum;
433 433
             }
434 434
 
435
-            if (! empty($this->subpartitionBy)) {
435
+            if (!empty($this->subpartitionBy)) {
436 436
                 $partition .= "\nSUBPARTITION BY " . $this->subpartitionBy;
437 437
             }
438 438
 
439
-            if (! empty($this->subpartitionsNum)) {
439
+            if (!empty($this->subpartitionsNum)) {
440 440
                 $partition .= "\nSUBPARTITIONS " . $this->subpartitionsNum;
441 441
             }
442 442
 
443
-            if (! empty($this->partitions)) {
443
+            if (!empty($this->partitions)) {
444 444
                 $partition .= "\n" . PartitionDefinitions::buildAll($this->partitions);
445 445
             }
446 446
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
                         $token = $list->getNextOfType(TokenType::Number);
631 631
                         --$list->idx; // `getNextOfType` also advances one position.
632 632
                         $this->subpartitionsNum = $token->value;
633
-                    } elseif (! empty($field)) {
633
+                    } elseif (!empty($field)) {
634 634
                         /*
635 635
                          * Handling the content of `PARTITION BY` and `SUBPARTITION BY`.
636 636
                          */
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
                             $field = null;
660 660
                         }
661 661
                     } elseif (($token->type === TokenType::Operator) && ($token->value === '(')) {
662
-                        if (! empty($this->partitionBy)) {
662
+                        if (!empty($this->partitionBy)) {
663 663
                             $this->partitions = ArrayObjs::parse(
664 664
                                 $parser,
665 665
                                 $list,
Please login to merge, or discard this patch.
tests/Parser/ParserLongExportsTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             if ($statement instanceof TransactionStatement) {
67 67
                 $this->assertNotNull($statement->statements);
68 68
                 foreach ($statement->statements as $transactionStatement) {
69
-                    if (! $transactionStatement instanceof SetStatement) {
69
+                    if (!$transactionStatement instanceof SetStatement) {
70 70
                         continue;
71 71
                     }
72 72
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                 continue;
77 77
             }
78 78
 
79
-            if (! $statement instanceof SetStatement) {
79
+            if (!$statement instanceof SetStatement) {
80 80
                 continue;
81 81
             }
82 82
 
Please login to merge, or discard this patch.
src/Token.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
     /**
71 71
      * The value this token contains (i.e. token after some evaluation).
72 72
      */
73
-    public bool|float|int|string $value;
73
+    public bool | float | int | string $value;
74 74
 
75 75
     /**
76 76
      * The keyword value this token contains, always uppercase.
77 77
      */
78
-    public string|null $keyword = null;
78
+    public string | null $keyword = null;
79 79
 
80 80
     /**
81 81
      * The type of this token.
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      * The position is counted in chars, not bytes, so you should
94 94
      * use mb_* functions to properly handle utf-8 multibyte chars.
95 95
      */
96
-    public int|null $position = null;
96
+    public int | null $position = null;
97 97
 
98 98
     /**
99 99
      * @param string    $token the value of the token
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
      *
114 114
      * If no processing can be done it will return the initial string.
115 115
      */
116
-    public function extract(): bool|float|int|string
116
+    public function extract(): bool | float | int | string
117 117
     {
118 118
         switch ($this->type) {
119 119
             case TokenType::Keyword:
120 120
                 $this->keyword = strtoupper($this->token);
121
-                if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) {
121
+                if (!($this->flags & self::FLAG_KEYWORD_RESERVED)) {
122 122
                     // Unreserved keywords should stay the way they are because they
123 123
                     // might represent field names.
124 124
                     return $this->token;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                     }
144 144
                 } elseif (($this->flags & self::FLAG_NUMBER_APPROXIMATE) || ($this->flags & self::FLAG_NUMBER_FLOAT)) {
145 145
                     $ret = (float) $ret;
146
-                } elseif (! ($this->flags & self::FLAG_NUMBER_BINARY)) {
146
+                } elseif (!($this->flags & self::FLAG_NUMBER_BINARY)) {
147 147
                     $ret = (int) $ret;
148 148
                 }
149 149
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
                     // in PHP 5.3- the `null` parameter isn't handled correctly.
179 179
                     $str = mb_substr(
180 180
                         $str,
181
-                        ! empty($str[1]) && ($str[1] === '@') ? 2 : 1,
181
+                        !empty($str[1]) && ($str[1] === '@') ? 2 : 1,
182 182
                         mb_strlen($str),
183 183
                         'UTF-8',
184 184
                     );
Please login to merge, or discard this patch.