@@ -80,23 +80,23 @@ discard block |
||
| 80 | 80 | $flags->distinct = true; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if (! empty($statement->group) || ! empty($statement->having)) { |
|
| 83 | + if (!empty($statement->group) || !empty($statement->having)) { |
|
| 84 | 84 | $flags->isGroup = true; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if (! empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 87 | + if (!empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 88 | 88 | $flags->isExport = true; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $expressions = $statement->expr; |
| 92 | - if (! empty($statement->join)) { |
|
| 92 | + if (!empty($statement->join)) { |
|
| 93 | 93 | foreach ($statement->join as $join) { |
| 94 | 94 | $expressions[] = $join->expr; |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | foreach ($expressions as $expr) { |
| 99 | - if (! empty($expr->function)) { |
|
| 99 | + if (!empty($expr->function)) { |
|
| 100 | 100 | if ($expr->function === 'COUNT') { |
| 101 | 101 | $flags->isCount = true; |
| 102 | 102 | } elseif (in_array($expr->function, static::$functions)) { |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | $flags->isSubQuery = true; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 114 | + if (!empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 115 | 115 | $flags->isAnalyse = true; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if (! empty($statement->group)) { |
|
| 118 | + if (!empty($statement->group)) { |
|
| 119 | 119 | $flags->group = true; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if (! empty($statement->having)) { |
|
| 122 | + if (!empty($statement->having)) { |
|
| 123 | 123 | $flags->having = true; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @param Statement|null $statement the statement to be processed |
| 141 | 141 | */ |
| 142 | - public static function getFlags(Statement|null $statement): StatementFlags |
|
| 142 | + public static function getFlags(Statement | null $statement): StatementFlags |
|
| 143 | 143 | { |
| 144 | 144 | $flags = new StatementFlags(); |
| 145 | 145 | |
@@ -215,11 +215,11 @@ discard block |
||
| 215 | 215 | || ($statement instanceof UpdateStatement) |
| 216 | 216 | || ($statement instanceof DeleteStatement) |
| 217 | 217 | ) { |
| 218 | - if (! empty($statement->limit)) { |
|
| 218 | + if (!empty($statement->limit)) { |
|
| 219 | 219 | $flags->limit = true; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if (! empty($statement->order)) { |
|
| 222 | + if (!empty($statement->order)) { |
|
| 223 | 223 | $flags->order = true; |
| 224 | 224 | } |
| 225 | 225 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | // Finding tables' aliases and their associated real names. |
| 250 | 250 | $tableAliases = []; |
| 251 | 251 | foreach ($statement->from as $expr) { |
| 252 | - if (! isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 252 | + if (!isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 253 | 253 | continue; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | ]; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - if (! in_array($arr, $selectTables)) { |
|
| 277 | + if (!in_array($arr, $selectTables)) { |
|
| 278 | 278 | $selectTables[] = $arr; |
| 279 | 279 | } |
| 280 | 280 | } else { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | // extracted from the FROM clause. |
| 288 | 288 | if ($selectTables === []) { |
| 289 | 289 | foreach ($statement->from as $expr) { |
| 290 | - if (! isset($expr->table) || ($expr->table === '')) { |
|
| 290 | + if (!isset($expr->table) || ($expr->table === '')) { |
|
| 291 | 291 | continue; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement)) { |
| 329 | 329 | $expressions = [$statement->table]; |
| 330 | 330 | } elseif ($statement instanceof DropStatement) { |
| 331 | - if (! $statement->options->has('TABLE')) { |
|
| 331 | + if (!$statement->options->has('TABLE')) { |
|
| 332 | 332 | // No tables are dropped. |
| 333 | 333 | return []; |
| 334 | 334 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | Statement $statement, |
| 374 | 374 | TokensList $list, |
| 375 | 375 | string $clause, |
| 376 | - int|string $type = 0, |
|
| 376 | + int | string $type = 0, |
|
| 377 | 377 | bool $skipFirst = true, |
| 378 | 378 | ): string { |
| 379 | 379 | /** |
@@ -489,8 +489,8 @@ discard block |
||
| 489 | 489 | |
| 490 | 490 | if ( |
| 491 | 491 | $statement !== '' && |
| 492 | - ! ctype_space(mb_substr($statement, -1)) && |
|
| 493 | - ! ctype_space(mb_substr($part, 0, 1)) |
|
| 492 | + !ctype_space(mb_substr($statement, -1)) && |
|
| 493 | + !ctype_space(mb_substr($part, 0, 1)) |
|
| 494 | 494 | ) { |
| 495 | 495 | $statement .= ' '; |
| 496 | 496 | } |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | Statement $statement, |
| 521 | 521 | TokensList $list, |
| 522 | 522 | string $old, |
| 523 | - string|null $new = null, |
|
| 523 | + string | null $new = null, |
|
| 524 | 524 | bool $onlyType = false, |
| 525 | 525 | ): string { |
| 526 | 526 | // TODO: Update the tokens list and the statement. |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | * the remaining part of the query and the last delimiter |
| 594 | 594 | * @psalm-return array{string|null, string, string|null} |
| 595 | 595 | */ |
| 596 | - public static function getFirstStatement(string $query, string|null $delimiter = null): array |
|
| 596 | + public static function getFirstStatement(string $query, string | null $delimiter = null): array |
|
| 597 | 597 | { |
| 598 | 598 | $lexer = new Lexer($query, false, $delimiter); |
| 599 | 599 | $list = $lexer->list; |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | $statement .= $token->token; |
| 619 | 619 | |
| 620 | - if (($token->type === TokenType::Delimiter) && ! empty($token->token)) { |
|
| 620 | + if (($token->type === TokenType::Delimiter) && !empty($token->token)) { |
|
| 621 | 621 | $delimiter = $token->token; |
| 622 | 622 | $fullStatement = true; |
| 623 | 623 | break; |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | // No statement was found so we return the entire query as being the |
| 628 | 628 | // remaining part. |
| 629 | - if (! $fullStatement) { |
|
| 629 | + if (!$fullStatement) { |
|
| 630 | 630 | return [ |
| 631 | 631 | null, |
| 632 | 632 | $query, |