Passed
Pull Request — master (#505)
by
unknown
04:43 queued 01:55
created
src/Lexer.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         $len = $str instanceof UtfString ? $str->length() : strlen($str);
175 175
 
176 176
         // For multi-byte strings, a new instance of `UtfString` is initialized.
177
-        if (! $str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) {
177
+        if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) {
178 178
             $str = new UtfString($str);
179 179
         }
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         $this->strict = $strict;
185 185
 
186 186
         // Setting the delimiter.
187
-        $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter);
187
+        $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter);
188 188
 
189 189
         $this->lex();
190 190
     }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
                 $delimiterLen = 0;
309 309
                 while (
310 310
                     ++$this->last < $this->len
311
-                    && ! Context::isWhitespace($this->str[$this->last])
311
+                    && !Context::isWhitespace($this->str[$this->last])
312 312
                     && $delimiterLen < 15
313 313
                 ) {
314 314
                     $this->delimiter .= $this->str[$this->last];
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
             }
368 368
 
369 369
             if (
370
-                ($next->type !== Token::TYPE_KEYWORD || ! in_array($next->value, ['FROM', 'USING'], true))
371
-                && ($next->type !== Token::TYPE_OPERATOR || ! in_array($next->value, [',', ')'], true))
370
+                ($next->type !== Token::TYPE_KEYWORD || !in_array($next->value, ['FROM', 'USING'], true))
371
+                && ($next->type !== Token::TYPE_OPERATOR || !in_array($next->value, [',', ')'], true))
372 372
             ) {
373 373
                 continue;
374 374
             }
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
             $next = $this->list->getNext();
407 407
             if (
408 408
                 ($next->type !== Token::TYPE_KEYWORD
409
-                    || ! in_array($next->value, self::KEYWORD_NAME_INDICATORS, true)
409
+                    || !in_array($next->value, self::KEYWORD_NAME_INDICATORS, true)
410 410
                 )
411 411
                 && ($next->type !== Token::TYPE_OPERATOR
412
-                    || ! in_array($next->value, self::OPERATOR_NAME_INDICATORS, true)
412
+                    || !in_array($next->value, self::OPERATOR_NAME_INDICATORS, true)
413 413
                 )
414 414
                 && ($next->value !== null)
415 415
             ) {
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     /**
449 449
      * Parses a keyword.
450 450
      */
451
-    public function parseKeyword(): Token|null
451
+    public function parseKeyword(): Token | null
452 452
     {
453 453
         $token = '';
454 454
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
             $token .= $this->str[$this->last];
489 489
             $flags = Context::isKeyword($token);
490 490
 
491
-            if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) {
491
+            if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) {
492 492
                 continue;
493 493
             }
494 494
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
     /**
509 509
      * Parses a label.
510 510
      */
511
-    public function parseLabel(): Token|null
511
+    public function parseLabel(): Token | null
512 512
     {
513 513
         $token = '';
514 514
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
     /**
553 553
      * Parses an operator.
554 554
      */
555
-    public function parseOperator(): Token|null
555
+    public function parseOperator(): Token | null
556 556
     {
557 557
         $token = '';
558 558
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
             $token .= $this->str[$this->last];
573 573
             $flags = Context::isOperator($token);
574 574
 
575
-            if (! $flags) {
575
+            if (!$flags) {
576 576
                 continue;
577 577
             }
578 578
 
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
     /**
589 589
      * Parses a whitespace.
590 590
      */
591
-    public function parseWhitespace(): Token|null
591
+    public function parseWhitespace(): Token | null
592 592
     {
593 593
         $token = $this->str[$this->last];
594 594
 
595
-        if (! Context::isWhitespace($token)) {
595
+        if (!Context::isWhitespace($token)) {
596 596
             return null;
597 597
         }
598 598
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     /**
609 609
      * Parses a comment.
610 610
      */
611
-    public function parseComment(): Token|null
611
+    public function parseComment(): Token | null
612 612
     {
613 613
         $iBak = $this->last;
614 614
         $token = $this->str[$this->last];
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
     /**
726 726
      * Parses a boolean.
727 727
      */
728
-    public function parseBool(): Token|null
728
+    public function parseBool(): Token | null
729 729
     {
730 730
         if ($this->last + 3 >= $this->len) {
731 731
             // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
     /**
757 757
      * Parses a number.
758 758
      */
759
-    public function parseNumber(): Token|null
759
+    public function parseNumber(): Token | null
760 760
     {
761 761
         // A rudimentary state machine is being used to parse numbers due to
762 762
         // the various forms of their notation.
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
             } elseif ($state === 2) {
827 827
                 $flags |= Token::FLAG_NUMBER_HEX;
828 828
                 if (
829
-                    ! (
829
+                    !(
830 830
                         ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9')
831 831
                         || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F')
832 832
                         || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f')
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
      *
923 923
      * @throws LexerException
924 924
      */
925
-    public function parseString($quote = ''): Token|null
925
+    public function parseString($quote = ''): Token | null
926 926
     {
927 927
         $token = $this->str[$this->last];
928 928
         $flags = Context::isString($token);
929 929
 
930
-        if (! $flags && $token !== $quote) {
930
+        if (!$flags && $token !== $quote) {
931 931
             return null;
932 932
         }
933 933
 
@@ -972,12 +972,12 @@  discard block
 block discarded – undo
972 972
      *
973 973
      * @throws LexerException
974 974
      */
975
-    public function parseSymbol(): Token|null
975
+    public function parseSymbol(): Token | null
976 976
     {
977 977
         $token = $this->str[$this->last];
978 978
         $flags = Context::isSymbol($token);
979 979
 
980
-        if (! $flags) {
980
+        if (!$flags) {
981 981
             return null;
982 982
         }
983 983
 
@@ -1019,14 +1019,14 @@  discard block
 block discarded – undo
1019 1019
     /**
1020 1020
      * Parses unknown parts of the query.
1021 1021
      */
1022
-    public function parseUnknown(): Token|null
1022
+    public function parseUnknown(): Token | null
1023 1023
     {
1024 1024
         $token = $this->str[$this->last];
1025 1025
         if (Context::isSeparator($token)) {
1026 1026
             return null;
1027 1027
         }
1028 1028
 
1029
-        while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) {
1029
+        while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) {
1030 1030
             $token .= $this->str[$this->last];
1031 1031
 
1032 1032
             // Test if end of token equals the current delimiter. If so, remove it from the token.
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
     /**
1046 1046
      * Parses the delimiter of the query.
1047 1047
      */
1048
-    public function parseDelimiter(): Token|null
1048
+    public function parseDelimiter(): Token | null
1049 1049
     {
1050 1050
         $idx = 0;
1051 1051
 
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
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
                 // The options of a clause should stay on the same line and everything that follows.
435 435
                 if (
436 436
                     $this->options['parts_newline']
437
-                    && ! $formattedOptions
437
+                    && !$formattedOptions
438 438
                     && empty(self::$inlineClauses[$lastClause])
439 439
                     && (
440 440
                         $curr->type !== Token::TYPE_KEYWORD
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                         end($blocksLineEndings) === true
492 492
                         || (
493 493
                             empty(self::$inlineClauses[$lastClause])
494
-                            && ! $shortGroup
494
+                            && !$shortGroup
495 495
                             && $this->options['parts_newline']
496 496
                         )
497 497
                     ) {
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                     $lineEnded = false;
528 528
                 } elseif (
529 529
                     $prev->keyword === 'DELIMITER'
530
-                    || ! (
530
+                    || !(
531 531
                     ($prev->type === Token::TYPE_OPERATOR && ($prev->value === '.' || $prev->value === '('))
532 532
                     // No space after . (
533 533
                     || ($curr->type === Token::TYPE_OPERATOR
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
         static $prev;
642 642
 
643 643
         foreach ($this->options['formats'] as $format) {
644
-            if ($token->type !== $format['type'] || ! (($token->flags & $format['flags']) === $format['flags'])) {
644
+            if ($token->type !== $format['type'] || !(($token->flags & $format['flags']) === $format['flags'])) {
645 645
                 continue;
646 646
             }
647 647
 
648 648
             // Running transformation function.
649
-            if (! empty($format['function'])) {
649
+            if (!empty($format['function'])) {
650 650
                 $func = $format['function'];
651 651
                 $text = $func($text);
652 652
             }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
      *
756 756
      * @psalm-return 1|2|false
757 757
      */
758
-    public static function isClause($token): int|false
758
+    public static function isClause($token): int | false
759 759
     {
760 760
         if (
761 761
             ($token->type === Token::TYPE_KEYWORD && isset(Parser::STATEMENT_PARSERS[$token->keyword]))
Please login to merge, or discard this patch.
src/Parser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
                 $list->idx = $lastIdx;
489 489
             } elseif (empty(self::STATEMENT_PARSERS[$token->keyword])) {
490 490
                 // Checking if it is a known statement that can be parsed.
491
-                if (! isset(self::STATEMENT_PARSERS[$token->keyword])) {
491
+                if (!isset(self::STATEMENT_PARSERS[$token->keyword])) {
492 492
                     // A statement is considered recognized if the parser
493 493
                     // is aware that it is a statement, but it does not have
494 494
                     // a parser for it yet.
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 
529 529
             // Handles unions.
530 530
             if (
531
-                ! empty($unionType)
531
+                !empty($unionType)
532 532
                 && ($lastStatement instanceof SelectStatement)
533 533
                 && ($statement instanceof SelectStatement)
534 534
             ) {
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
      *
616 616
      * @throws ParserException throws the exception, if strict mode is enabled.
617 617
      */
618
-    public function error($msg, Token|null $token = null, $code = 0): void
618
+    public function error($msg, Token | null $token = null, $code = 0): void
619 619
     {
620 620
         $error = new ParserException(
621 621
             Translator::gettext($msg),
Please login to merge, or discard this patch.
src/Components/JoinKeyword.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             }
189 189
         }
190 190
 
191
-        if (! empty($expr->type)) {
191
+        if (!empty($expr->type)) {
192 192
             $ret[] = $expr;
193 193
         }
194 194
 
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
         $ret = [];
214 214
         foreach ($component as $c) {
215 215
             $ret[] = array_search($c->type, self::JOINS) . ' ' . $c->expr
216
-                . (! empty($c->on)
216
+                . (!empty($c->on)
217 217
                     ? ' ON ' . Condition::buildAll($c->on) : '')
218
-                . (! empty($c->using)
218
+                . (!empty($c->using)
219 219
                     ? ' USING ' . ArrayObj::build($c->using) : '');
220 220
         }
221 221
 
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
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      *
155 155
      * @throws ParserException
156 156
      */
157
-    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null
157
+    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null
158 158
     {
159 159
         $ret = new static();
160 160
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         ];
198 198
 
199 199
         // When a field is parsed, no parentheses are expected.
200
-        if (! empty($options['parseField'])) {
200
+        if (!empty($options['parseField'])) {
201 201
             $options['breakOnParentheses'] = true;
202 202
             $options['field'] = $options['parseField'];
203 203
         }
@@ -224,14 +224,14 @@  discard block
 block discarded – undo
224 224
             }
225 225
 
226 226
             if ($token->type === Token::TYPE_KEYWORD) {
227
-                if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
227
+                if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
228 228
                     // A `(` was previously found and this keyword is the
229 229
                     // beginning of a statement, so this is a subquery.
230 230
                     $ret->subquery = $token->keyword;
231 231
                 } elseif (
232 232
                     ($token->flags & Token::FLAG_KEYWORD_FUNCTION)
233 233
                     && (empty($options['parseField'])
234
-                    && ! $alias)
234
+                    && !$alias)
235 235
                 ) {
236 236
                     $isExpr = true;
237 237
                 } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
                     }
244 244
 
245 245
                     if ($token->keyword === 'AS') {
246
-                        if (! empty($options['breakOnAlias'])) {
246
+                        if (!empty($options['breakOnAlias'])) {
247 247
                             break;
248 248
                         }
249 249
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
                     }
267 267
 
268 268
                     $isExpr = true;
269
-                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) {
269
+                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) {
270 270
                     /* End of expression */
271 271
                     break;
272 272
                 }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                 || (($token->type === Token::TYPE_OPERATOR)
283 283
                 && ($token->value !== '.'))
284 284
             ) {
285
-                if (! empty($options['parseField'])) {
285
+                if (!empty($options['parseField'])) {
286 286
                     break;
287 287
                 }
288 288
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             }
293 293
 
294 294
             if ($token->type === Token::TYPE_OPERATOR) {
295
-                if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
295
+                if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
296 296
                     // No brackets were expected.
297 297
                     break;
298 298
                 }
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
                     --$brackets;
318 318
                     if ($brackets === 0) {
319
-                        if (! empty($options['parenthesesDelimited'])) {
319
+                        if (!empty($options['parenthesesDelimited'])) {
320 320
                             // The current token is the last bracket, the next
321 321
                             // one will be outside the expression.
322 322
                             $ret->expr .= $token->token;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 
343 343
             if ($alias) {
344 344
                 // An alias is expected (the keyword `AS` was previously found).
345
-                if (! empty($ret->alias)) {
345
+                if (!empty($ret->alias)) {
346 346
                     $parser->error('An alias was previously found.', $token);
347 347
                     break;
348 348
                 }
@@ -356,14 +356,14 @@  discard block
 block discarded – undo
356 356
                     && ($prev[0] === null
357 357
                         || (($prev[0]->type !== Token::TYPE_OPERATOR || $prev[0]->token === ')')
358 358
                             && ($prev[0]->type !== Token::TYPE_KEYWORD
359
-                                || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
359
+                                || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
360 360
                     && (($prev[1]->type === Token::TYPE_STRING)
361 361
                         || ($prev[1]->type === Token::TYPE_SYMBOL
362
-                            && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE))
362
+                            && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE))
363 363
                         || ($prev[1]->type === Token::TYPE_NONE
364 364
                             && $prev[1]->token !== 'OVER'))
365 365
                 ) {
366
-                    if (! empty($ret->alias)) {
366
+                    if (!empty($ret->alias)) {
367 367
                         $parser->error('An alias was previously found.', $token);
368 368
                         break;
369 369
                     }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                     // Found a `.` which means we expect a column name and
395 395
                     // the column name we parsed is actually the table name
396 396
                     // and the table name is actually a database name.
397
-                    if (! empty($ret->database) || $dot) {
397
+                    if (!empty($ret->database) || $dot) {
398 398
                         $parser->error('Unexpected dot.', $token);
399 399
                     }
400 400
 
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
                         $dot = false;
412 412
                     } else {
413 413
                         // No alias is expected.
414
-                        if (! empty($options['breakOnAlias'])) {
414
+                        if (!empty($options['breakOnAlias'])) {
415 415
                             break;
416 416
                         }
417 417
 
418
-                        if (! empty($ret->alias)) {
418
+                        if (!empty($ret->alias)) {
419 419
                             $parser->error('An alias was previously found.', $token);
420 420
                             break;
421 421
                         }
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
             $ret = implode('.', Context::escapeAll($fields));
467 467
         }
468 468
 
469
-        if (! empty($component->alias)) {
469
+        if (!empty($component->alias)) {
470 470
             $ret .= ' AS ' . Context::escape($component->alias);
471 471
         }
472 472
 
Please login to merge, or discard this patch.
src/Components/AlterOperation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
                     } elseif (($token->value === ',') && ($brackets === 0)) {
408 408
                         break;
409 409
                     }
410
-                } elseif (! self::checkIfTokenQuotedSymbol($token)) {
410
+                } elseif (!self::checkIfTokenQuotedSymbol($token)) {
411 411
                     // If the current token is "SET" or "ENUM", we want to avoid the token between their parenthesis in
412 412
                     // the unknown tokens.
413 413
                     if (in_array($token->value, ['SET', 'ENUM'], true)) {
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                             );
427 427
                             break;
428 428
                         }
429
-                    } elseif (! empty(Parser::STATEMENT_PARSERS[$token->value])) {
429
+                    } elseif (!empty(Parser::STATEMENT_PARSERS[$token->value])) {
430 430
                         // We have reached the end of ALTER operation and suddenly found
431 431
                         // a start to new statement, but have not found a delimiter between them
432 432
                         $parser->error(
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
                     } elseif (
438 438
                         (array_key_exists($arrayKey, self::DATABASE_OPTIONS)
439 439
                         || array_key_exists($arrayKey, self::TABLE_OPTIONS))
440
-                        && ! self::checkIfColumnDefinitionKeyword($arrayKey)
440
+                        && !self::checkIfColumnDefinitionKeyword($arrayKey)
441 441
                     ) {
442 442
                         // This alter operation has finished, which means a comma
443 443
                         // was missing before start of new alter operation
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
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @param Parser|null     $parser the instance that requests parsing
89 89
      * @param TokensList|null $list   the list of tokens to be parsed
90 90
      */
91
-    public function __construct(Parser|null $parser = null, TokensList|null $list = null)
91
+    public function __construct(Parser | null $parser = null, TokensList | null $list = null)
92 92
     {
93 93
         if (($parser === null) || ($list === null)) {
94 94
             return;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
             // Checking if this field was already built.
167 167
             if ($type & 1) {
168
-                if (! empty($built[$field])) {
168
+                if (!empty($built[$field])) {
169 169
                     continue;
170 170
                 }
171 171
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             }
179 179
 
180 180
             // Checking if the result of the builder should be added.
181
-            if (! ($type & 1)) {
181
+            if (!($type & 1)) {
182 182
                 continue;
183 183
             }
184 184
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
             $options = [];
305 305
 
306 306
             // Looking for duplicated clauses.
307
-            if (! empty(Parser::KEYWORD_PARSERS[$token->value]) || ! empty(Parser::STATEMENT_PARSERS[$token->value])) {
308
-                if (! empty($parsedClauses[$token->value])) {
307
+            if (!empty(Parser::KEYWORD_PARSERS[$token->value]) || !empty(Parser::STATEMENT_PARSERS[$token->value])) {
308
+                if (!empty($parsedClauses[$token->value])) {
309 309
                     $parser->error('This type of clause was previously parsed.', $token);
310 310
                     break;
311 311
                 }
@@ -318,18 +318,18 @@  discard block
 block discarded – undo
318 318
             // but it might be the beginning of a statement of truncate,
319 319
             // so let the value use the keyword field for truncate type.
320 320
             $tokenValue = in_array($token->keyword, ['TRUNCATE']) ? $token->keyword : $token->value;
321
-            if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) {
321
+            if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) {
322 322
                 $class = Parser::KEYWORD_PARSERS[$tokenValue]['class'];
323 323
                 $field = Parser::KEYWORD_PARSERS[$tokenValue]['field'];
324
-                if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) {
324
+                if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) {
325 325
                     $options = Parser::KEYWORD_PARSERS[$tokenValue]['options'];
326 326
                 }
327 327
             }
328 328
 
329 329
             // Checking if this is the beginning of the statement.
330
-            if (! empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
330
+            if (!empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
331 331
                 if (
332
-                    ! empty(static::$clauses) // Undefined for some statements.
332
+                    !empty(static::$clauses) // Undefined for some statements.
333 333
                     && empty(static::$clauses[$token->value])
334 334
                 ) {
335 335
                     // Some keywords (e.g. `SET`) may be the beginning of a
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                     break;
345 345
                 }
346 346
 
347
-                if (! $parsedOptions) {
347
+                if (!$parsedOptions) {
348 348
                     if (empty(static::$statementOptions[$token->value])) {
349 349
                         // Skipping keyword because if it is not a option.
350 350
                         ++$list->idx;
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                 if ($minJoin === 0 && stripos($clauseType, 'JOIN')) {
518 518
                     // First JOIN clause is detected
519 519
                     $minJoin = $maxJoin = $clauseStartIdx;
520
-                } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) {
520
+                } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) {
521 521
                     // After a previous JOIN clause, a non-JOIN clause has been detected
522 522
                     $maxJoin = $lastIdx;
523 523
                 } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) {
Please login to merge, or discard this patch.