@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | switch ($this->type) { |
129 | 129 | case TokenType::Keyword: |
130 | 130 | $this->keyword = strtoupper($this->token); |
131 | - if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) { |
|
131 | + if (!($this->flags & self::FLAG_KEYWORD_RESERVED)) { |
|
132 | 132 | // Unreserved keywords should stay the way they are because they |
133 | 133 | // might represent field names. |
134 | 134 | return $this->token; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | } elseif (($this->flags & self::FLAG_NUMBER_APPROXIMATE) || ($this->flags & self::FLAG_NUMBER_FLOAT)) { |
155 | 155 | $ret = (float) $ret; |
156 | - } elseif (! ($this->flags & self::FLAG_NUMBER_BINARY)) { |
|
156 | + } elseif (!($this->flags & self::FLAG_NUMBER_BINARY)) { |
|
157 | 157 | $ret = (int) $ret; |
158 | 158 | } |
159 | 159 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // in PHP 5.3- the `null` parameter isn't handled correctly. |
189 | 189 | $str = mb_substr( |
190 | 190 | $str, |
191 | - ! empty($str[1]) && ($str[1] === '@') ? 2 : 1, |
|
191 | + !empty($str[1]) && ($str[1] === '@') ? 2 : 1, |
|
192 | 192 | mb_strlen($str), |
193 | 193 | 'UTF-8' |
194 | 194 | ); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } else { |
152 | 152 | // The expression ended. |
153 | 153 | $expr->expr = trim($expr->expr); |
154 | - if (! empty($expr->expr)) { |
|
154 | + if (!empty($expr->expr)) { |
|
155 | 155 | $ret[] = $expr; |
156 | 156 | } |
157 | 157 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | if ( |
170 | 170 | ($token->type === TokenType::Keyword) |
171 | 171 | && ($token->flags & Token::FLAG_KEYWORD_RESERVED) |
172 | - && ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
172 | + && !($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
173 | 173 | ) { |
174 | 174 | if ($token->value === 'BETWEEN') { |
175 | 175 | $betweenBefore = true; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | // Last iteration was not processed. |
214 | 214 | $expr->expr = trim($expr->expr); |
215 | - if (! empty($expr->expr)) { |
|
215 | + if (!empty($expr->expr)) { |
|
216 | 216 | $ret[] = $expr; |
217 | 217 | } |
218 | 218 |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param TokensList $list the list of tokens that are being parsed |
96 | 96 | * @param array<string, mixed> $options parameters for parsing |
97 | 97 | */ |
98 | - public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null |
|
98 | + public static function parse(Parser $parser, TokensList $list, array $options = []): DataType | null |
|
99 | 99 | { |
100 | 100 | $ret = new static(); |
101 | 101 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | if ($state === 0) { |
127 | 127 | $ret->name = strtoupper((string) $token->value); |
128 | - if (($token->type !== TokenType::Keyword) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
128 | + if (($token->type !== TokenType::Keyword) || (!($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
129 | 129 | $parser->error('Unrecognized data type.', $token); |
130 | 130 | } |
131 | 131 |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | // Handle optional AS keyword before alias |
201 | 201 | if ($token->type === TokenType::Keyword && $token->keyword === 'AS') { |
202 | - if ($asFound || ! empty($ret->alias)) { |
|
202 | + if ($asFound || !empty($ret->alias)) { |
|
203 | 203 | $parser->error('Potential duplicate alias of CASE expression.', $token); |
204 | 204 | break; |
205 | 205 | } |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | if ( |
222 | 222 | $asFound |
223 | 223 | || $token->type === TokenType::String |
224 | - || ($token->type === TokenType::Symbol && ! $token->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
224 | + || ($token->type === TokenType::Symbol && !$token->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
225 | 225 | || $token->type === TokenType::None |
226 | 226 | ) { |
227 | 227 | // An alias is expected (the keyword `AS` was previously found). |
228 | - if (! empty($ret->alias)) { |
|
228 | + if (!empty($ret->alias)) { |
|
229 | 229 | $parser->error('An alias was previously found.', $token); |
230 | 230 | break; |
231 | 231 | } |
@@ -87,7 +87,7 @@ |
||
87 | 87 | if ($token->type === TokenType::Operator && $token->value === '(') { |
88 | 88 | --$list->idx; // ArrayObj needs to start with `(` |
89 | 89 | $state = 1; |
90 | - continue;// do not add this token to the name |
|
90 | + continue; // do not add this token to the name |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | $ret->name .= $token->value; |
@@ -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, |
@@ -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 |
@@ -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 |