@@ -299,23 +299,23 @@ discard block |
||
| 299 | 299 | $flags['distinct'] = true; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - if (! empty($statement->group) || ! empty($statement->having)) { |
|
| 302 | + if (!empty($statement->group) || !empty($statement->having)) { |
|
| 303 | 303 | $flags['is_group'] = true; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - if (! empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 306 | + if (!empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 307 | 307 | $flags['is_export'] = true; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | $expressions = $statement->expr; |
| 311 | - if (! empty($statement->join)) { |
|
| 311 | + if (!empty($statement->join)) { |
|
| 312 | 312 | foreach ($statement->join as $join) { |
| 313 | 313 | $expressions[] = $join->expr; |
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | foreach ($expressions as $expr) { |
| 318 | - if (! empty($expr->function)) { |
|
| 318 | + if (!empty($expr->function)) { |
|
| 319 | 319 | if ($expr->function === 'COUNT') { |
| 320 | 320 | $flags['is_count'] = true; |
| 321 | 321 | } elseif (in_array($expr->function, static::$functions)) { |
@@ -330,15 +330,15 @@ discard block |
||
| 330 | 330 | $flags['is_subquery'] = true; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 333 | + if (!empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 334 | 334 | $flags['is_analyse'] = true; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - if (! empty($statement->group)) { |
|
| 337 | + if (!empty($statement->group)) { |
|
| 338 | 338 | $flags['group'] = true; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - if (! empty($statement->having)) { |
|
| 341 | + if (!empty($statement->having)) { |
|
| 342 | 342 | $flags['having'] = true; |
| 343 | 343 | } |
| 344 | 344 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $flags['union'] = true; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | - if (! empty($statement->join)) { |
|
| 349 | + if (!empty($statement->join)) { |
|
| 350 | 350 | $flags['join'] = true; |
| 351 | 351 | } |
| 352 | 352 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | * @return array<string, bool|string> |
| 363 | 363 | * @psalm-return QueryFlagsType |
| 364 | 364 | */ |
| 365 | - public static function getFlags(Statement|null $statement, bool $all = false): array |
|
| 365 | + public static function getFlags(Statement | null $statement, bool $all = false): array |
|
| 366 | 366 | { |
| 367 | 367 | $flags = ['querytype' => false]; |
| 368 | 368 | if ($all) { |
@@ -437,11 +437,11 @@ discard block |
||
| 437 | 437 | || ($statement instanceof UpdateStatement) |
| 438 | 438 | || ($statement instanceof DeleteStatement) |
| 439 | 439 | ) { |
| 440 | - if (! empty($statement->limit)) { |
|
| 440 | + if (!empty($statement->limit)) { |
|
| 441 | 441 | $flags['limit'] = true; |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - if (! empty($statement->order)) { |
|
| 444 | + if (!empty($statement->order)) { |
|
| 445 | 445 | $flags['order'] = true; |
| 446 | 446 | } |
| 447 | 447 | } |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | // Finding tables' aliases and their associated real names. |
| 492 | 492 | $tableAliases = []; |
| 493 | 493 | foreach ($statement->from as $expr) { |
| 494 | - if (! isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 494 | + if (!isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 495 | 495 | continue; |
| 496 | 496 | } |
| 497 | 497 | |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | ]; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - if (! in_array($arr, $ret['select_tables'])) { |
|
| 519 | + if (!in_array($arr, $ret['select_tables'])) { |
|
| 520 | 520 | $ret['select_tables'][] = $arr; |
| 521 | 521 | } |
| 522 | 522 | } else { |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | // extracted from the FROM clause. |
| 530 | 530 | if ($ret['select_tables'] === []) { |
| 531 | 531 | foreach ($statement->from as $expr) { |
| 532 | - if (! isset($expr->table) || ($expr->table === '')) { |
|
| 532 | + if (!isset($expr->table) || ($expr->table === '')) { |
|
| 533 | 533 | continue; |
| 534 | 534 | } |
| 535 | 535 | |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement)) { |
| 571 | 571 | $expressions = [$statement->table]; |
| 572 | 572 | } elseif ($statement instanceof DropStatement) { |
| 573 | - if (! $statement->options->has('TABLE')) { |
|
| 573 | + if (!$statement->options->has('TABLE')) { |
|
| 574 | 574 | // No tables are dropped. |
| 575 | 575 | return []; |
| 576 | 576 | } |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | Statement $statement, |
| 616 | 616 | TokensList $list, |
| 617 | 617 | string $clause, |
| 618 | - int|string $type = 0, |
|
| 618 | + int | string $type = 0, |
|
| 619 | 619 | bool $skipFirst = true |
| 620 | 620 | ): string { |
| 621 | 621 | /** |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | Statement $statement, |
| 748 | 748 | TokensList $list, |
| 749 | 749 | string $old, |
| 750 | - string|null $new = null, |
|
| 750 | + string | null $new = null, |
|
| 751 | 751 | bool $onlyType = false |
| 752 | 752 | ): string { |
| 753 | 753 | // TODO: Update the tokens list and the statement. |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | * the remaining part of the query and the last delimiter |
| 827 | 827 | * @psalm-return array{string|null, string, string|null} |
| 828 | 828 | */ |
| 829 | - public static function getFirstStatement(string $query, string|null $delimiter = null): array |
|
| 829 | + public static function getFirstStatement(string $query, string | null $delimiter = null): array |
|
| 830 | 830 | { |
| 831 | 831 | $lexer = new Lexer($query, false, $delimiter); |
| 832 | 832 | $list = $lexer->list; |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | $statement .= $token->token; |
| 856 | 856 | |
| 857 | - if (($token->type === TokenType::Delimiter) && ! empty($token->token)) { |
|
| 857 | + if (($token->type === TokenType::Delimiter) && !empty($token->token)) { |
|
| 858 | 858 | $delimiter = $token->token; |
| 859 | 859 | $fullStatement = true; |
| 860 | 860 | break; |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | |
| 864 | 864 | // No statement was found so we return the entire query as being the |
| 865 | 865 | // remaining part. |
| 866 | - if (! $fullStatement) { |
|
| 866 | + if (!$fullStatement) { |
|
| 867 | 867 | return [ |
| 868 | 868 | null, |
| 869 | 869 | $query, |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public static function getForeignKeys(CreateStatement $statement): array |
| 32 | 32 | { |
| 33 | - if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) { |
|
| 33 | + if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) { |
|
| 34 | 34 | return []; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $columns = []; |
| 45 | 45 | foreach ($field->key->columns as $column) { |
| 46 | - if (! isset($column['name'])) { |
|
| 46 | + if (!isset($column['name'])) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'index_list' => $columns, |
| 56 | 56 | ]; |
| 57 | 57 | |
| 58 | - if (! empty($field->references)) { |
|
| 58 | + if (!empty($field->references)) { |
|
| 59 | 59 | $tmp['ref_db_name'] = $field->references->table->database; |
| 60 | 60 | $tmp['ref_table_name'] = $field->references->table->table; |
| 61 | 61 | $tmp['ref_index_list'] = $field->references->columns; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public static function getFields(CreateStatement $statement): array |
| 98 | 98 | { |
| 99 | - if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) { |
|
| 99 | + if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) { |
|
| 100 | 100 | return []; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | 'timestamp_not_null' => false, |
| 114 | 114 | ]; |
| 115 | 115 | |
| 116 | - if (! $field->options) { |
|
| 116 | + if (!$field->options) { |
|
| 117 | 117 | continue; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $option = $field->options->has('AS'); |
| 142 | 142 | |
| 143 | - if (! $option) { |
|
| 143 | + if (!$option) { |
|
| 144 | 144 | continue; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param int|string $rowCount the row count |
| 34 | 34 | * @param int|string $offset the offset |
| 35 | 35 | */ |
| 36 | - public function __construct(int|string $rowCount = 0, int|string $offset = 0) |
|
| 36 | + public function __construct(int | string $rowCount = 0, int | string $offset = 0) |
|
| 37 | 37 | { |
| 38 | 38 | $this->rowCount = $rowCount; |
| 39 | 39 | $this->offset = $offset; |
@@ -87,7 +87,7 @@ discard block |
||
| 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; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param string|null $name the name of the function to be called |
| 35 | 35 | * @param string[]|ArrayObj|null $parameters the parameters of this function |
| 36 | 36 | */ |
| 37 | - public function __construct(string|null $name = null, array|ArrayObj|null $parameters = null) |
|
| 37 | + public function __construct(string | null $name = null, array | ArrayObj | null $parameters = null) |
|
| 38 | 38 | { |
| 39 | 39 | $this->name = $name; |
| 40 | 40 | if (is_array($parameters)) { |
@@ -87,7 +87,7 @@ discard block |
||
| 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; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param Expression $old old expression |
| 35 | 35 | * @param Expression $new new expression containing new name |
| 36 | 36 | */ |
| 37 | - public function __construct(Expression|null $old = null, Expression|null $new = null) |
|
| 37 | + public function __construct(Expression | null $old = null, Expression | null $new = null) |
|
| 38 | 38 | { |
| 39 | 39 | $this->old = $old; |
| 40 | 40 | $this->new = $new; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // Last iteration was not saved. |
| 141 | - if (! empty($expr->old)) { |
|
| 141 | + if (!empty($expr->old)) { |
|
| 142 | 142 | $ret[] = $expr; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | * @param bool|null $fieldsKeyword options for OPTIONS keyword |
| 114 | 114 | */ |
| 115 | 115 | public function __construct( |
| 116 | - string|null $type = null, |
|
| 117 | - string|Expression|null $dest = null, |
|
| 118 | - array|null $columns = null, |
|
| 119 | - array|null $values = null, |
|
| 120 | - OptionsArray|null $fieldsOptions = null, |
|
| 121 | - bool|null $fieldsKeyword = null |
|
| 116 | + string | null $type = null, |
|
| 117 | + string | Expression | null $dest = null, |
|
| 118 | + array | null $columns = null, |
|
| 119 | + array | null $values = null, |
|
| 120 | + OptionsArray | null $fieldsOptions = null, |
|
| 121 | + bool | null $fieldsKeyword = null |
|
| 122 | 122 | ) { |
| 123 | 123 | $this->type = $type; |
| 124 | 124 | $this->dest = $dest; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | public function build(): string |
| 255 | 255 | { |
| 256 | 256 | if ($this->dest instanceof Expression) { |
| 257 | - $columns = ! empty($this->columns) ? '(`' . implode('`, `', $this->columns) . '`)' : ''; |
|
| 257 | + $columns = !empty($this->columns) ? '(`' . implode('`, `', $this->columns) . '`)' : ''; |
|
| 258 | 258 | |
| 259 | 259 | return $this->dest . $columns; |
| 260 | 260 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * @param string $expr the condition or the operator |
| 82 | 82 | */ |
| 83 | - public function __construct(string|null $expr = null) |
|
| 83 | + public function __construct(string | null $expr = null) |
|
| 84 | 84 | { |
| 85 | 85 | $this->expr = trim((string) $expr); |
| 86 | 86 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } else { |
| 148 | 148 | // The expression ended. |
| 149 | 149 | $expr->expr = trim($expr->expr); |
| 150 | - if (! empty($expr->expr)) { |
|
| 150 | + if (!empty($expr->expr)) { |
|
| 151 | 151 | $ret[] = $expr; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | if ( |
| 166 | 166 | ($token->type === TokenType::Keyword) |
| 167 | 167 | && ($token->flags & Token::FLAG_KEYWORD_RESERVED) |
| 168 | - && ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
| 168 | + && !($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
| 169 | 169 | ) { |
| 170 | 170 | if ($token->value === 'BETWEEN') { |
| 171 | 171 | $betweenBefore = true; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | // Last iteration was not processed. |
| 210 | 210 | $expr->expr = trim($expr->expr); |
| 211 | - if (! empty($expr->expr)) { |
|
| 211 | + if (!empty($expr->expr)) { |
|
| 212 | 212 | $ret[] = $expr; |
| 213 | 213 | } |
| 214 | 214 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | final class GroupKeyword implements Component |
| 19 | 19 | { |
| 20 | 20 | /** @var 'ASC'|'DESC'|null */ |
| 21 | - public string|null $type = null; |
|
| 21 | + public string | null $type = null; |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * The expression that is used for grouping. |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * @param Expression $expr the expression that we are sorting by |
| 32 | 32 | */ |
| 33 | - public function __construct(Expression|null $expr = null) |
|
| 33 | + public function __construct(Expression | null $expr = null) |
|
| 34 | 34 | { |
| 35 | 35 | $this->expr = $expr; |
| 36 | 36 | } |
@@ -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 | |
@@ -264,9 +264,9 @@ discard block |
||
| 264 | 264 | * @param Token[] $unknown unparsed tokens found at the end of operation |
| 265 | 265 | */ |
| 266 | 266 | public function __construct( |
| 267 | - OptionsArray|null $options = null, |
|
| 268 | - Expression|string|null $field = null, |
|
| 269 | - array|null $partitions = null, |
|
| 267 | + OptionsArray | null $options = null, |
|
| 268 | + Expression | string | null $field = null, |
|
| 269 | + array | null $partitions = null, |
|
| 270 | 270 | public array $unknown = [] |
| 271 | 271 | ) { |
| 272 | 272 | $this->partitions = $partitions; |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } elseif (($token->value === ',') && ($brackets === 0)) { |
| 402 | 402 | break; |
| 403 | 403 | } |
| 404 | - } elseif (! self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) { |
|
| 404 | + } elseif (!self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) { |
|
| 405 | 405 | if (isset(Parser::STATEMENT_PARSERS[$arrayKey]) && Parser::STATEMENT_PARSERS[$arrayKey] !== '') { |
| 406 | 406 | $list->idx++; // Ignore the current token |
| 407 | 407 | $nextToken = $list->getNext(); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | } elseif ( |
| 425 | 425 | (array_key_exists($arrayKey, self::DATABASE_OPTIONS) |
| 426 | 426 | || array_key_exists($arrayKey, self::TABLE_OPTIONS)) |
| 427 | - && ! self::checkIfColumnDefinitionKeyword($arrayKey) |
|
| 427 | + && !self::checkIfColumnDefinitionKeyword($arrayKey) |
|
| 428 | 428 | ) { |
| 429 | 429 | // This alter operation has finished, which means a comma |
| 430 | 430 | // was missing before start of new alter operation |