@@ -300,23 +300,23 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | |
846 | 846 | $statement .= $token->token; |
847 | 847 | |
848 | - if (($token->type === TokenType::Delimiter) && ! empty($token->token)) { |
|
848 | + if (($token->type === TokenType::Delimiter) && !empty($token->token)) { |
|
849 | 849 | $delimiter = $token->token; |
850 | 850 | $fullStatement = true; |
851 | 851 | break; |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | |
855 | 855 | // No statement was found so we return the entire query as being the |
856 | 856 | // remaining part. |
857 | - if (! $fullStatement) { |
|
857 | + if (!$fullStatement) { |
|
858 | 858 | return [ |
859 | 859 | null, |
860 | 860 | $query, |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * Gets the next token. Skips any irrelevant token (whitespaces and |
95 | 95 | * comments). |
96 | 96 | */ |
97 | - public function getNext(): Token|null |
|
97 | + public function getNext(): Token | null |
|
98 | 98 | { |
99 | 99 | for (; $this->idx < $this->count; ++$this->idx) { |
100 | 100 | if ( |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * Gets the previous token. Skips any irrelevant token (whitespaces and |
113 | 113 | * comments). |
114 | 114 | */ |
115 | - public function getPrevious(): Token|null |
|
115 | + public function getPrevious(): Token | null |
|
116 | 116 | { |
117 | 117 | for (; $this->idx >= 0; --$this->idx) { |
118 | 118 | if ( |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @param TokenType|TokenType[] $type the type |
133 | 133 | */ |
134 | - public function getPreviousOfType(TokenType|array $type): Token|null |
|
134 | + public function getPreviousOfType(TokenType | array $type): Token | null |
|
135 | 135 | { |
136 | - if (! is_array($type)) { |
|
136 | + if (!is_array($type)) { |
|
137 | 137 | $type = [$type]; |
138 | 138 | } |
139 | 139 | |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @param TokenType|TokenType[] $type the type |
153 | 153 | */ |
154 | - public function getNextOfType(TokenType|array $type): Token|null |
|
154 | + public function getNextOfType(TokenType | array $type): Token | null |
|
155 | 155 | { |
156 | - if (! is_array($type)) { |
|
156 | + if (!is_array($type)) { |
|
157 | 157 | $type = [$type]; |
158 | 158 | } |
159 | 159 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param TokenType $type the type of the token |
173 | 173 | * @param string $value the value of the token |
174 | 174 | */ |
175 | - public function getNextOfTypeAndValue(TokenType $type, $value): Token|null |
|
175 | + public function getNextOfTypeAndValue(TokenType $type, $value): Token | null |
|
176 | 176 | { |
177 | 177 | for (; $this->idx < $this->count; ++$this->idx) { |
178 | 178 | if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->value === $value)) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @param TokenType $type the type of the token |
190 | 190 | * @param int $flag the flag of the token |
191 | 191 | */ |
192 | - public function getNextOfTypeAndFlag(TokenType $type, int $flag): Token|null |
|
192 | + public function getNextOfTypeAndFlag(TokenType $type, int $flag): Token | null |
|
193 | 193 | { |
194 | 194 | for (; $this->idx < $this->count; ++$this->idx) { |
195 | 195 | if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->flags === $flag)) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @param int $offset the offset to be returned |
222 | 222 | */ |
223 | - public function offsetGet($offset): Token|null |
|
223 | + public function offsetGet($offset): Token | null |
|
224 | 224 | { |
225 | 225 | return $offset < $this->count ? $this->tokens[$offset] : null; |
226 | 226 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | - if (! empty($expr->type)) { |
|
191 | + if (!empty($expr->type)) { |
|
192 | 192 | $ret[] = $expr; |
193 | 193 | } |
194 | 194 | |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | $ret = []; |
211 | 211 | foreach ($component as $c) { |
212 | 212 | $ret[] = array_search($c->type, self::JOINS) . ' ' . $c->expr |
213 | - . (! empty($c->on) |
|
213 | + . (!empty($c->on) |
|
214 | 214 | ? ' ON ' . Condition::buildAll($c->on) : '') |
215 | - . (! empty($c->using) |
|
215 | + . (!empty($c->using) |
|
216 | 216 | ? ' USING ' . $c->using->build() : ''); |
217 | 217 | } |
218 | 218 |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $len = $str instanceof UtfString ? $str->length() : strlen($str); |
160 | 160 | |
161 | 161 | // For multi-byte strings, a new instance of `UtfString` is initialized. |
162 | - if (! $str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
162 | + if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
163 | 163 | $str = new UtfString($str); |
164 | 164 | } |
165 | 165 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $this->strict = $strict; |
170 | 170 | |
171 | 171 | // Setting the delimiter. |
172 | - $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
172 | + $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
173 | 173 | |
174 | 174 | $this->lex(); |
175 | 175 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $delimiterLen = 0; |
294 | 294 | while ( |
295 | 295 | ++$this->last < $this->len |
296 | - && ! Context::isWhitespace($this->str[$this->last]) |
|
296 | + && !Context::isWhitespace($this->str[$this->last]) |
|
297 | 297 | && $delimiterLen < 15 |
298 | 298 | ) { |
299 | 299 | $this->delimiter .= $this->str[$this->last]; |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | if ( |
355 | - ($next->type !== TokenType::Keyword || ! in_array($next->value, ['FROM', 'USING'], true)) |
|
356 | - && ($next->type !== TokenType::Operator || ! in_array($next->value, [',', ')'], true)) |
|
355 | + ($next->type !== TokenType::Keyword || !in_array($next->value, ['FROM', 'USING'], true)) |
|
356 | + && ($next->type !== TokenType::Operator || !in_array($next->value, [',', ')'], true)) |
|
357 | 357 | ) { |
358 | 358 | continue; |
359 | 359 | } |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | $next = $this->list->getNext(); |
392 | 392 | if ( |
393 | 393 | ($next->type !== TokenType::Keyword |
394 | - || ! in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
394 | + || !in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
395 | 395 | ) |
396 | 396 | && ($next->type !== TokenType::Operator |
397 | - || ! in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
397 | + || !in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
398 | 398 | ) |
399 | 399 | && ($next->value !== null) |
400 | 400 | ) { |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | /** |
434 | 434 | * Parses a keyword. |
435 | 435 | */ |
436 | - public function parseKeyword(): Token|null |
|
436 | + public function parseKeyword(): Token | null |
|
437 | 437 | { |
438 | 438 | $token = ''; |
439 | 439 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $token .= $this->str[$this->last]; |
474 | 474 | $flags = Context::isKeyword($token); |
475 | 475 | |
476 | - if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) { |
|
476 | + if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) { |
|
477 | 477 | continue; |
478 | 478 | } |
479 | 479 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | /** |
494 | 494 | * Parses a label. |
495 | 495 | */ |
496 | - public function parseLabel(): Token|null |
|
496 | + public function parseLabel(): Token | null |
|
497 | 497 | { |
498 | 498 | $token = ''; |
499 | 499 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | /** |
538 | 538 | * Parses an operator. |
539 | 539 | */ |
540 | - public function parseOperator(): Token|null |
|
540 | + public function parseOperator(): Token | null |
|
541 | 541 | { |
542 | 542 | $token = ''; |
543 | 543 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $token .= $this->str[$this->last]; |
558 | 558 | $flags = Context::isOperator($token); |
559 | 559 | |
560 | - if (! $flags) { |
|
560 | + if (!$flags) { |
|
561 | 561 | continue; |
562 | 562 | } |
563 | 563 | |
@@ -573,11 +573,11 @@ discard block |
||
573 | 573 | /** |
574 | 574 | * Parses a whitespace. |
575 | 575 | */ |
576 | - public function parseWhitespace(): Token|null |
|
576 | + public function parseWhitespace(): Token | null |
|
577 | 577 | { |
578 | 578 | $token = $this->str[$this->last]; |
579 | 579 | |
580 | - if (! Context::isWhitespace($token)) { |
|
580 | + if (!Context::isWhitespace($token)) { |
|
581 | 581 | return null; |
582 | 582 | } |
583 | 583 | |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | /** |
594 | 594 | * Parses a comment. |
595 | 595 | */ |
596 | - public function parseComment(): Token|null |
|
596 | + public function parseComment(): Token | null |
|
597 | 597 | { |
598 | 598 | $iBak = $this->last; |
599 | 599 | $token = $this->str[$this->last]; |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | /** |
711 | 711 | * Parses a boolean. |
712 | 712 | */ |
713 | - public function parseBool(): Token|null |
|
713 | + public function parseBool(): Token | null |
|
714 | 714 | { |
715 | 715 | if ($this->last + 3 >= $this->len) { |
716 | 716 | // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | /** |
742 | 742 | * Parses a number. |
743 | 743 | */ |
744 | - public function parseNumber(): Token|null |
|
744 | + public function parseNumber(): Token | null |
|
745 | 745 | { |
746 | 746 | // A rudimentary state machine is being used to parse numbers due to |
747 | 747 | // the various forms of their notation. |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | } elseif ($state === 2) { |
809 | 809 | $flags |= Token::FLAG_NUMBER_HEX; |
810 | 810 | if ( |
811 | - ! ( |
|
811 | + !( |
|
812 | 812 | ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') |
813 | 813 | || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F') |
814 | 814 | || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f') |
@@ -904,12 +904,12 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @throws LexerException |
906 | 906 | */ |
907 | - public function parseString($quote = ''): Token|null |
|
907 | + public function parseString($quote = ''): Token | null |
|
908 | 908 | { |
909 | 909 | $token = $this->str[$this->last]; |
910 | 910 | $flags = Context::isString($token); |
911 | 911 | |
912 | - if (! $flags && $token !== $quote) { |
|
912 | + if (!$flags && $token !== $quote) { |
|
913 | 913 | return null; |
914 | 914 | } |
915 | 915 | |
@@ -954,12 +954,12 @@ discard block |
||
954 | 954 | * |
955 | 955 | * @throws LexerException |
956 | 956 | */ |
957 | - public function parseSymbol(): Token|null |
|
957 | + public function parseSymbol(): Token | null |
|
958 | 958 | { |
959 | 959 | $token = $this->str[$this->last]; |
960 | 960 | $flags = Context::isSymbol($token); |
961 | 961 | |
962 | - if (! $flags) { |
|
962 | + if (!$flags) { |
|
963 | 963 | return null; |
964 | 964 | } |
965 | 965 | |
@@ -1001,14 +1001,14 @@ discard block |
||
1001 | 1001 | /** |
1002 | 1002 | * Parses unknown parts of the query. |
1003 | 1003 | */ |
1004 | - public function parseUnknown(): Token|null |
|
1004 | + public function parseUnknown(): Token | null |
|
1005 | 1005 | { |
1006 | 1006 | $token = $this->str[$this->last]; |
1007 | 1007 | if (Context::isSeparator($token)) { |
1008 | 1008 | return null; |
1009 | 1009 | } |
1010 | 1010 | |
1011 | - while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) { |
|
1011 | + while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) { |
|
1012 | 1012 | $token .= $this->str[$this->last]; |
1013 | 1013 | |
1014 | 1014 | // Test if end of token equals the current delimiter. If so, remove it from the token. |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | /** |
1028 | 1028 | * Parses the delimiter of the query. |
1029 | 1029 | */ |
1030 | - public function parseDelimiter(): Token|null |
|
1030 | + public function parseDelimiter(): Token | null |
|
1031 | 1031 | { |
1032 | 1032 | $idx = 0; |
1033 | 1033 |
@@ -435,7 +435,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
758 | 758 | * |
759 | 759 | * @psalm-return 1|2|false |
760 | 760 | */ |
761 | - public static function isClause($token): int|false |
|
761 | + public static function isClause($token): int | false |
|
762 | 762 | { |
763 | 763 | if ( |
764 | 764 | ($token->type === TokenType::Keyword && isset(Parser::STATEMENT_PARSERS[$token->keyword])) |
@@ -88,7 +88,7 @@ discard block |
||
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 |
||
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 |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @throws ParserException |
157 | 157 | */ |
158 | - public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null |
|
158 | + public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null |
|
159 | 159 | { |
160 | 160 | $ret = new static(); |
161 | 161 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | ]; |
199 | 199 | |
200 | 200 | // When a field is parsed, no parentheses are expected. |
201 | - if (! empty($options['parseField'])) { |
|
201 | + if (!empty($options['parseField'])) { |
|
202 | 202 | $options['breakOnParentheses'] = true; |
203 | 203 | $options['field'] = $options['parseField']; |
204 | 204 | } |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | if ($token->type === TokenType::Keyword) { |
228 | - if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
228 | + if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
229 | 229 | // A `(` was previously found and this keyword is the |
230 | 230 | // beginning of a statement, so this is a subquery. |
231 | 231 | $ret->subquery = $token->keyword; |
232 | 232 | } elseif ( |
233 | 233 | ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
234 | 234 | && (empty($options['parseField']) |
235 | - && ! $alias) |
|
235 | + && !$alias) |
|
236 | 236 | ) { |
237 | 237 | $isExpr = true; |
238 | 238 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | if ($token->keyword === 'AS') { |
247 | - if (! empty($options['breakOnAlias'])) { |
|
247 | + if (!empty($options['breakOnAlias'])) { |
|
248 | 248 | break; |
249 | 249 | } |
250 | 250 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | $isExpr = true; |
270 | - } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) { |
|
270 | + } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) { |
|
271 | 271 | /* End of expression */ |
272 | 272 | break; |
273 | 273 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | || (($token->type === TokenType::Operator) |
284 | 284 | && ($token->value !== '.')) |
285 | 285 | ) { |
286 | - if (! empty($options['parseField'])) { |
|
286 | + if (!empty($options['parseField'])) { |
|
287 | 287 | break; |
288 | 288 | } |
289 | 289 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | if ($token->type === TokenType::Operator) { |
296 | - if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
296 | + if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
297 | 297 | // No brackets were expected. |
298 | 298 | break; |
299 | 299 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | --$brackets; |
319 | 319 | if ($brackets === 0) { |
320 | - if (! empty($options['parenthesesDelimited'])) { |
|
320 | + if (!empty($options['parenthesesDelimited'])) { |
|
321 | 321 | // The current token is the last bracket, the next |
322 | 322 | // one will be outside the expression. |
323 | 323 | $ret->expr .= $token->token; |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | if ($alias) { |
345 | 345 | // An alias is expected (the keyword `AS` was previously found). |
346 | - if (! empty($ret->alias)) { |
|
346 | + if (!empty($ret->alias)) { |
|
347 | 347 | $parser->error('An alias was previously found.', $token); |
348 | 348 | break; |
349 | 349 | } |
@@ -357,14 +357,14 @@ discard block |
||
357 | 357 | && ($prev[0] === null |
358 | 358 | || (($prev[0]->type !== TokenType::Operator || $prev[0]->token === ')') |
359 | 359 | && ($prev[0]->type !== TokenType::Keyword |
360 | - || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
360 | + || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
361 | 361 | && (($prev[1]->type === TokenType::String) |
362 | 362 | || ($prev[1]->type === TokenType::Symbol |
363 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
363 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
364 | 364 | || ($prev[1]->type === TokenType::None |
365 | 365 | && $prev[1]->token !== 'OVER')) |
366 | 366 | ) { |
367 | - if (! empty($ret->alias)) { |
|
367 | + if (!empty($ret->alias)) { |
|
368 | 368 | $parser->error('An alias was previously found.', $token); |
369 | 369 | break; |
370 | 370 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | // Found a `.` which means we expect a column name and |
396 | 396 | // the column name we parsed is actually the table name |
397 | 397 | // and the table name is actually a database name. |
398 | - if (! empty($ret->database) || $dot) { |
|
398 | + if (!empty($ret->database) || $dot) { |
|
399 | 399 | $parser->error('Unexpected dot.', $token); |
400 | 400 | } |
401 | 401 | |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | $dot = false; |
413 | 413 | } else { |
414 | 414 | // No alias is expected. |
415 | - if (! empty($options['breakOnAlias'])) { |
|
415 | + if (!empty($options['breakOnAlias'])) { |
|
416 | 416 | break; |
417 | 417 | } |
418 | 418 | |
419 | - if (! empty($ret->alias)) { |
|
419 | + if (!empty($ret->alias)) { |
|
420 | 420 | $parser->error('An alias was previously found.', $token); |
421 | 421 | break; |
422 | 422 | } |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $ret = implode('.', Context::escapeAll($fields)); |
465 | 465 | } |
466 | 466 | |
467 | - if (! empty($this->alias)) { |
|
467 | + if (!empty($this->alias)) { |
|
468 | 468 | $ret .= ' AS ' . Context::escape($this->alias); |
469 | 469 | } |
470 | 470 |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | } elseif ($state === 1) { |
175 | 175 | if (($token->type === TokenType::Operator) && ($token->value === '(')) { |
176 | 176 | $positionBeforeSearch = $list->idx; |
177 | - $list->idx++;// Ignore the current token "(" or the search condition will always be true |
|
177 | + $list->idx++; // Ignore the current token "(" or the search condition will always be true |
|
178 | 178 | $nextToken = $list->getNext(); |
179 | - $list->idx = $positionBeforeSearch;// Restore the position |
|
179 | + $list->idx = $positionBeforeSearch; // Restore the position |
|
180 | 180 | |
181 | 181 | if ($nextToken !== null && $nextToken->value === '(') { |
182 | 182 | // Switch to expression mode |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | if ($token->type === TokenType::Operator) { |
226 | 226 | // This got back to here and we reached the end of the expression |
227 | 227 | if ($token->value === ')') { |
228 | - $state = 4;// go back to state 4 to fetch options |
|
228 | + $state = 4; // go back to state 4 to fetch options |
|
229 | 229 | continue; |
230 | 230 | } |
231 | 231 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function build(): string |
262 | 262 | { |
263 | 263 | $ret = $this->type . ' '; |
264 | - if (! empty($this->name)) { |
|
264 | + if (!empty($this->name)) { |
|
265 | 265 | $ret .= Context::escape($this->name) . ' '; |
266 | 266 | } |
267 | 267 |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $state = 4; |
237 | 237 | } elseif ($token->type === TokenType::Symbol || $token->type === TokenType::None) { |
238 | 238 | $expr->name = $token->value; |
239 | - if (! $expr->isConstraint) { |
|
239 | + if (!$expr->isConstraint) { |
|
240 | 240 | $state = 2; |
241 | 241 | } |
242 | 242 | } elseif ($token->type === TokenType::Keyword) { |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | $state = 5; |
279 | 279 | } elseif ($state === 5) { |
280 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
280 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
281 | 281 | $ret[] = $expr; |
282 | 282 | } |
283 | 283 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | // Last iteration was not saved. |
300 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
300 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
301 | 301 | $ret[] = $expr; |
302 | 302 | } |
303 | 303 | |
@@ -322,16 +322,16 @@ discard block |
||
322 | 322 | $tmp .= Context::escape($this->name) . ' '; |
323 | 323 | } |
324 | 324 | |
325 | - if (! empty($this->type)) { |
|
325 | + if (!empty($this->type)) { |
|
326 | 326 | $this->type->lowercase = true; |
327 | 327 | $tmp .= $this->type->build() . ' '; |
328 | 328 | } |
329 | 329 | |
330 | - if (! empty($this->key)) { |
|
330 | + if (!empty($this->key)) { |
|
331 | 331 | $tmp .= $this->key . ' '; |
332 | 332 | } |
333 | 333 | |
334 | - if (! empty($this->references)) { |
|
334 | + if (!empty($this->references)) { |
|
335 | 335 | $tmp .= 'REFERENCES ' . $this->references . ' '; |
336 | 336 | } |
337 | 337 |