Completed
Push — master ( d6e0d4...577b1c )
by Maurício
17s queued 15s
created
src/Utils/Query.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -300,23 +300,23 @@  discard block
 block discarded – undo
300 300
             $flags['distinct'] = true;
301 301
         }
302 302
 
303
-        if (! empty($statement->group) || ! empty($statement->having)) {
303
+        if (!empty($statement->group) || !empty($statement->having)) {
304 304
             $flags['is_group'] = true;
305 305
         }
306 306
 
307
-        if (! empty($statement->into) && ($statement->into->type === 'OUTFILE')) {
307
+        if (!empty($statement->into) && ($statement->into->type === 'OUTFILE')) {
308 308
             $flags['is_export'] = true;
309 309
         }
310 310
 
311 311
         $expressions = $statement->expr;
312
-        if (! empty($statement->join)) {
312
+        if (!empty($statement->join)) {
313 313
             foreach ($statement->join as $join) {
314 314
                 $expressions[] = $join->expr;
315 315
             }
316 316
         }
317 317
 
318 318
         foreach ($expressions as $expr) {
319
-            if (! empty($expr->function)) {
319
+            if (!empty($expr->function)) {
320 320
                 if ($expr->function === 'COUNT') {
321 321
                     $flags['is_count'] = true;
322 322
                 } elseif (in_array($expr->function, static::$functions)) {
@@ -331,15 +331,15 @@  discard block
 block discarded – undo
331 331
             $flags['is_subquery'] = true;
332 332
         }
333 333
 
334
-        if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) {
334
+        if (!empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) {
335 335
             $flags['is_analyse'] = true;
336 336
         }
337 337
 
338
-        if (! empty($statement->group)) {
338
+        if (!empty($statement->group)) {
339 339
             $flags['group'] = true;
340 340
         }
341 341
 
342
-        if (! empty($statement->having)) {
342
+        if (!empty($statement->having)) {
343 343
             $flags['having'] = true;
344 344
         }
345 345
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $flags['union'] = true;
348 348
         }
349 349
 
350
-        if (! empty($statement->join)) {
350
+        if (!empty($statement->join)) {
351 351
             $flags['join'] = true;
352 352
         }
353 353
 
@@ -438,11 +438,11 @@  discard block
 block discarded – undo
438 438
             || ($statement instanceof UpdateStatement)
439 439
             || ($statement instanceof DeleteStatement)
440 440
         ) {
441
-            if (! empty($statement->limit)) {
441
+            if (!empty($statement->limit)) {
442 442
                 $flags['limit'] = true;
443 443
             }
444 444
 
445
-            if (! empty($statement->order)) {
445
+            if (!empty($statement->order)) {
446 446
                 $flags['order'] = true;
447 447
             }
448 448
         }
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
             // Finding tables' aliases and their associated real names.
493 493
             $tableAliases = [];
494 494
             foreach ($statement->from as $expr) {
495
-                if (! isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) {
495
+                if (!isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) {
496 496
                     continue;
497 497
                 }
498 498
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                         ];
518 518
                     }
519 519
 
520
-                    if (! in_array($arr, $ret['select_tables'])) {
520
+                    if (!in_array($arr, $ret['select_tables'])) {
521 521
                         $ret['select_tables'][] = $arr;
522 522
                     }
523 523
                 } else {
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
             // extracted from the FROM clause.
531 531
             if ($ret['select_tables'] === []) {
532 532
                 foreach ($statement->from as $expr) {
533
-                    if (! isset($expr->table) || ($expr->table === '')) {
533
+                    if (!isset($expr->table) || ($expr->table === '')) {
534 534
                         continue;
535 535
                     }
536 536
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement)) {
572 572
             $expressions = [$statement->table];
573 573
         } elseif ($statement instanceof DropStatement) {
574
-            if (! $statement->options->has('TABLE')) {
574
+            if (!$statement->options->has('TABLE')) {
575 575
                 // No tables are dropped.
576 576
                 return [];
577 577
             }
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 
848 848
             $statement .= $token->token;
849 849
 
850
-            if (($token->type === Token::TYPE_DELIMITER) && ! empty($token->token)) {
850
+            if (($token->type === Token::TYPE_DELIMITER) && !empty($token->token)) {
851 851
                 $delimiter = $token->token;
852 852
                 $fullStatement = true;
853 853
                 break;
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 
857 857
         // No statement was found so we return the entire query as being the
858 858
         // remaining part.
859
-        if (! $fullStatement) {
859
+        if (!$fullStatement) {
860 860
             return [
861 861
                 null,
862 862
                 $query,
Please login to merge, or discard this patch.
src/Components/OptionsArray.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
             if ($lastOption === null) {
118 118
                 $upper = strtoupper($token->token);
119
-                if (! isset($options[$upper])) {
119
+                if (!isset($options[$upper])) {
120 120
                     // There is no option to be processed.
121 121
                     break;
122 122
                 }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             }
154 154
 
155 155
             if ($state === 0) {
156
-                if (! is_array($lastOption)) {
156
+                if (!is_array($lastOption)) {
157 157
                     // This is a just keyword option without any value.
158 158
                     // This is the beginning and the end of it.
159 159
                     $ret->options[$lastOptionId] = $token->value;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 $ret->options[$lastOptionId]['expr'] .= $token->token;
231 231
 
232 232
                 if (
233
-                    ! (($token->token === '(') && ($brackets === 1)
233
+                    !(($token->token === '(') && ($brackets === 1)
234 234
                     || (($token->token === ')') && ($brackets === 0)))
235 235
                 ) {
236 236
                     // First pair of brackets is being skipped.
@@ -286,12 +286,12 @@  discard block
 block discarded – undo
286 286
 
287 287
         $options = [];
288 288
         foreach ($component->options as $option) {
289
-            if (! is_array($option)) {
289
+            if (!is_array($option)) {
290 290
                 $options[] = $option;
291 291
             } else {
292 292
                 $options[] = $option['name']
293
-                    . (! empty($option['equals']) ? '=' : ' ')
294
-                    . (! empty($option['expr']) ? $option['expr'] : $option['value']);
293
+                    . (!empty($option['equals']) ? '=' : ' ')
294
+                    . (!empty($option['expr']) ? $option['expr'] : $option['value']);
295 295
             }
296 296
         }
297 297
 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
     {
312 312
         foreach ($this->options as $option) {
313 313
             if (is_array($option)) {
314
-                if (! strcasecmp($key, $option['name'])) {
314
+                if (!strcasecmp($key, $option['name'])) {
315 315
                     return $getExpr ? $option['expr'] : $option['value'];
316 316
                 }
317
-            } elseif (! strcasecmp($key, $option)) {
317
+            } elseif (!strcasecmp($key, $option)) {
318 318
                 return true;
319 319
             }
320 320
         }
@@ -333,12 +333,12 @@  discard block
 block discarded – undo
333 333
     {
334 334
         foreach ($this->options as $idx => $option) {
335 335
             if (is_array($option)) {
336
-                if (! strcasecmp($key, $option['name'])) {
336
+                if (!strcasecmp($key, $option['name'])) {
337 337
                     unset($this->options[$idx]);
338 338
 
339 339
                     return true;
340 340
                 }
341
-            } elseif (! strcasecmp($key, $option)) {
341
+            } elseif (!strcasecmp($key, $option)) {
342 342
                 unset($this->options[$idx]);
343 343
 
344 344
                 return true;
Please login to merge, or discard this patch.
src/Components/Expression.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      *
158 158
      * @throws ParserException
159 159
      */
160
-    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null
160
+    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null
161 161
     {
162 162
         $ret = new static();
163 163
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         ];
201 201
 
202 202
         // When a field is parsed, no parentheses are expected.
203
-        if (! empty($options['parseField'])) {
203
+        if (!empty($options['parseField'])) {
204 204
             $options['breakOnParentheses'] = true;
205 205
             $options['field'] = $options['parseField'];
206 206
         }
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
             }
228 228
 
229 229
             if ($token->type === Token::TYPE_KEYWORD) {
230
-                if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::$statementParsers[$token->keyword])) {
230
+                if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::$statementParsers[$token->keyword])) {
231 231
                     // A `(` was previously found and this keyword is the
232 232
                     // beginning of a statement, so this is a subquery.
233 233
                     $ret->subquery = $token->keyword;
234 234
                 } elseif (
235 235
                     ($token->flags & Token::FLAG_KEYWORD_FUNCTION)
236 236
                     && (empty($options['parseField'])
237
-                    && ! $alias)
237
+                    && !$alias)
238 238
                 ) {
239 239
                     $isExpr = true;
240 240
                 } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                     }
247 247
 
248 248
                     if ($token->keyword === 'AS') {
249
-                        if (! empty($options['breakOnAlias'])) {
249
+                        if (!empty($options['breakOnAlias'])) {
250 250
                             break;
251 251
                         }
252 252
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                     }
270 270
 
271 271
                     $isExpr = true;
272
-                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) {
272
+                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) {
273 273
                     /* End of expression */
274 274
                     break;
275 275
                 }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                 || (($token->type === Token::TYPE_OPERATOR)
286 286
                 && ($token->value !== '.'))
287 287
             ) {
288
-                if (! empty($options['parseField'])) {
288
+                if (!empty($options['parseField'])) {
289 289
                     break;
290 290
                 }
291 291
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             }
296 296
 
297 297
             if ($token->type === Token::TYPE_OPERATOR) {
298
-                if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
298
+                if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
299 299
                     // No brackets were expected.
300 300
                     break;
301 301
                 }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
                     --$brackets;
321 321
                     if ($brackets === 0) {
322
-                        if (! empty($options['parenthesesDelimited'])) {
322
+                        if (!empty($options['parenthesesDelimited'])) {
323 323
                             // The current token is the last bracket, the next
324 324
                             // one will be outside the expression.
325 325
                             $ret->expr .= $token->token;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 
346 346
             if ($alias) {
347 347
                 // An alias is expected (the keyword `AS` was previously found).
348
-                if (! empty($ret->alias)) {
348
+                if (!empty($ret->alias)) {
349 349
                     $parser->error('An alias was previously found.', $token);
350 350
                     break;
351 351
                 }
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
                     && ($prev[0] === null
360 360
                         || (($prev[0]->type !== Token::TYPE_OPERATOR || $prev[0]->token === ')')
361 361
                             && ($prev[0]->type !== Token::TYPE_KEYWORD
362
-                                || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
362
+                                || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
363 363
                     && (($prev[1]->type === Token::TYPE_STRING)
364 364
                         || ($prev[1]->type === Token::TYPE_SYMBOL
365
-                            && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE))
365
+                            && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE))
366 366
                         || ($prev[1]->type === Token::TYPE_NONE
367 367
                             && $prev[1]->token !== 'OVER'))
368 368
                 ) {
369
-                    if (! empty($ret->alias)) {
369
+                    if (!empty($ret->alias)) {
370 370
                         $parser->error('An alias was previously found.', $token);
371 371
                         break;
372 372
                     }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
                     // Found a `.` which means we expect a column name and
398 398
                     // the column name we parsed is actually the table name
399 399
                     // and the table name is actually a database name.
400
-                    if (! empty($ret->database) || $dot) {
400
+                    if (!empty($ret->database) || $dot) {
401 401
                         $parser->error('Unexpected dot.', $token);
402 402
                     }
403 403
 
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
                         $dot = false;
415 415
                     } else {
416 416
                         // No alias is expected.
417
-                        if (! empty($options['breakOnAlias'])) {
417
+                        if (!empty($options['breakOnAlias'])) {
418 418
                             break;
419 419
                         }
420 420
 
421
-                        if (! empty($ret->alias)) {
421
+                        if (!empty($ret->alias)) {
422 422
                             $parser->error('An alias was previously found.', $token);
423 423
                             break;
424 424
                         }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             $ret = implode('.', Context::escapeAll($fields));
474 474
         }
475 475
 
476
-        if (! empty($component->alias)) {
476
+        if (!empty($component->alias)) {
477 477
             $ret .= ' AS ' . Context::escape($component->alias);
478 478
         }
479 479
 
Please login to merge, or discard this patch.