@@ -14,18 +14,18 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * The number of rows skipped. |
| 16 | 16 | */ |
| 17 | - public int|string $offset; |
|
| 17 | + public int | string $offset; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * The number of rows to be returned. |
| 21 | 21 | */ |
| 22 | - public int|string $rowCount; |
|
| 22 | + public int | string $rowCount; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * @param int|string $rowCount the row count |
| 26 | 26 | * @param int|string $offset the offset |
| 27 | 27 | */ |
| 28 | - public function __construct(int|string $rowCount = 0, int|string $offset = 0) |
|
| 28 | + public function __construct(int | string $rowCount = 0, int | string $offset = 0) |
|
| 29 | 29 | { |
| 30 | 30 | $this->rowCount = $rowCount; |
| 31 | 31 | $this->offset = $offset; |
@@ -19,32 +19,32 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * The name of the new column. |
| 21 | 21 | */ |
| 22 | - public string|null $name = null; |
|
| 22 | + public string | null $name = null; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Whether this field is a constraint or not. |
| 26 | 26 | */ |
| 27 | - public bool|null $isConstraint = null; |
|
| 27 | + public bool | null $isConstraint = null; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * The data type of thew new column. |
| 31 | 31 | */ |
| 32 | - public DataType|null $type = null; |
|
| 32 | + public DataType | null $type = null; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * The key. |
| 36 | 36 | */ |
| 37 | - public Key|null $key = null; |
|
| 37 | + public Key | null $key = null; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * The table that is referenced. |
| 41 | 41 | */ |
| 42 | - public Reference|null $references = null; |
|
| 42 | + public Reference | null $references = null; |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * The options of this field. |
| 46 | 46 | */ |
| 47 | - public OptionsArray|null $options = null; |
|
| 47 | + public OptionsArray | null $options = null; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * @param string|null $name the name of the field |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | * @param Reference|null $references references |
| 55 | 55 | */ |
| 56 | 56 | public function __construct( |
| 57 | - string|null $name = null, |
|
| 58 | - OptionsArray|null $options = null, |
|
| 59 | - DataType|Key|null $type = null, |
|
| 57 | + string | null $name = null, |
|
| 58 | + OptionsArray | null $options = null, |
|
| 59 | + DataType | Key | null $type = null, |
|
| 60 | 60 | bool $isConstraint = false, |
| 61 | - Reference|null $references = null, |
|
| 61 | + Reference | null $references = null, |
|
| 62 | 62 | ) { |
| 63 | 63 | $this->name = $name; |
| 64 | 64 | $this->options = $options; |
@@ -83,16 +83,16 @@ discard block |
||
| 83 | 83 | $tmp .= Context::escape($this->name) . ' '; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if (! empty($this->type)) { |
|
| 86 | + if (!empty($this->type)) { |
|
| 87 | 87 | $this->type->lowercase = true; |
| 88 | 88 | $tmp .= $this->type->build() . ' '; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if (! empty($this->key)) { |
|
| 91 | + if (!empty($this->key)) { |
|
| 92 | 92 | $tmp .= $this->key . ' '; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if (! empty($this->references)) { |
|
| 95 | + if (!empty($this->references)) { |
|
| 96 | 96 | $tmp .= 'REFERENCES ' . $this->references . ' '; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -19,19 +19,19 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * Options of this operation. |
| 21 | 21 | */ |
| 22 | - public OptionsArray|null $options = null; |
|
| 22 | + public OptionsArray | null $options = null; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * The altered field. |
| 26 | 26 | */ |
| 27 | - public Expression|string|null $field = null; |
|
| 27 | + public Expression | string | null $field = null; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * The partitions. |
| 31 | 31 | * |
| 32 | 32 | * @var PartitionDefinition[]|null |
| 33 | 33 | */ |
| 34 | - public array|null $partitions = null; |
|
| 34 | + public array | null $partitions = null; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @param OptionsArray|null $options options of alter operation |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | * @param Token[] $unknown unparsed tokens found at the end of operation |
| 41 | 41 | */ |
| 42 | 42 | public function __construct( |
| 43 | - OptionsArray|null $options = null, |
|
| 44 | - Expression|string|null $field = null, |
|
| 45 | - array|null $partitions = null, |
|
| 43 | + OptionsArray | null $options = null, |
|
| 44 | + Expression | string | null $field = null, |
|
| 45 | + array | null $partitions = null, |
|
| 46 | 46 | public array $unknown = [], |
| 47 | 47 | ) { |
| 48 | 48 | $this->partitions = $partitions; |
@@ -134,7 +134,7 @@ |
||
| 134 | 134 | /** |
| 135 | 135 | * The type of the statement (which is usually the first keyword). |
| 136 | 136 | */ |
| 137 | - public StatementType|null $queryType = null; |
|
| 137 | + public StatementType | null $queryType = null; |
|
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * Whether a page reload is required. |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function __construct( |
| 21 | 21 | public readonly Parser $parser, |
| 22 | - public readonly Statement|null $statement, |
|
| 22 | + public readonly Statement | null $statement, |
|
| 23 | 23 | public readonly StatementFlags $flags, |
| 24 | 24 | public readonly array $selectTables, |
| 25 | 25 | public readonly array $selectExpressions, |
@@ -78,23 +78,23 @@ discard block |
||
| 78 | 78 | $flags->distinct = true; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (! empty($statement->group) || ! empty($statement->having)) { |
|
| 81 | + if (!empty($statement->group) || !empty($statement->having)) { |
|
| 82 | 82 | $flags->isGroup = true; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if (! empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 85 | + if (!empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 86 | 86 | $flags->isExport = true; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $expressions = $statement->expr; |
| 90 | - if (! empty($statement->join)) { |
|
| 90 | + if (!empty($statement->join)) { |
|
| 91 | 91 | foreach ($statement->join as $join) { |
| 92 | 92 | $expressions[] = $join->expr; |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | foreach ($expressions as $expr) { |
| 97 | - if (! empty($expr->function)) { |
|
| 97 | + if (!empty($expr->function)) { |
|
| 98 | 98 | if ($expr->function === 'COUNT') { |
| 99 | 99 | $flags->isCount = true; |
| 100 | 100 | } elseif (in_array($expr->function, static::$functions)) { |
@@ -109,15 +109,15 @@ discard block |
||
| 109 | 109 | $flags->isSubQuery = true; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 112 | + if (!empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 113 | 113 | $flags->isAnalyse = true; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if (! empty($statement->group)) { |
|
| 116 | + if (!empty($statement->group)) { |
|
| 117 | 117 | $flags->group = true; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if (! empty($statement->having)) { |
|
| 120 | + if (!empty($statement->having)) { |
|
| 121 | 121 | $flags->having = true; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @param Statement|null $statement the statement to be processed |
| 139 | 139 | */ |
| 140 | - public static function getFlags(Statement|null $statement): StatementFlags |
|
| 140 | + public static function getFlags(Statement | null $statement): StatementFlags |
|
| 141 | 141 | { |
| 142 | 142 | $flags = new StatementFlags(); |
| 143 | 143 | |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | || ($statement instanceof UpdateStatement) |
| 214 | 214 | || ($statement instanceof DeleteStatement) |
| 215 | 215 | ) { |
| 216 | - if (! empty($statement->limit)) { |
|
| 216 | + if (!empty($statement->limit)) { |
|
| 217 | 217 | $flags->limit = true; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - if (! empty($statement->order)) { |
|
| 220 | + if (!empty($statement->order)) { |
|
| 221 | 221 | $flags->order = true; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | // Finding tables' aliases and their associated real names. |
| 248 | 248 | $tableAliases = []; |
| 249 | 249 | foreach ($statement->from as $expr) { |
| 250 | - if (! isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 250 | + if (!isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 251 | 251 | continue; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | ]; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if (! in_array($arr, $selectTables)) { |
|
| 275 | + if (!in_array($arr, $selectTables)) { |
|
| 276 | 276 | $selectTables[] = $arr; |
| 277 | 277 | } |
| 278 | 278 | } else { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | // extracted from the FROM clause. |
| 286 | 286 | if ($selectTables === []) { |
| 287 | 287 | foreach ($statement->from as $expr) { |
| 288 | - if (! isset($expr->table) || ($expr->table === '')) { |
|
| 288 | + if (!isset($expr->table) || ($expr->table === '')) { |
|
| 289 | 289 | continue; |
| 290 | 290 | } |
| 291 | 291 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement)) { |
| 327 | 327 | $expressions = [$statement->table]; |
| 328 | 328 | } elseif ($statement instanceof DropStatement) { |
| 329 | - if (! $statement->options->has('TABLE')) { |
|
| 329 | + if (!$statement->options->has('TABLE')) { |
|
| 330 | 330 | // No tables are dropped. |
| 331 | 331 | return []; |
| 332 | 332 | } |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | Statement $statement, |
| 372 | 372 | TokensList $list, |
| 373 | 373 | string $clause, |
| 374 | - int|string $type = 0, |
|
| 374 | + int | string $type = 0, |
|
| 375 | 375 | bool $skipFirst = true, |
| 376 | 376 | ): string { |
| 377 | 377 | /** |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | Statement $statement, |
| 496 | 496 | TokensList $list, |
| 497 | 497 | string $old, |
| 498 | - string|null $new = null, |
|
| 498 | + string | null $new = null, |
|
| 499 | 499 | bool $onlyType = false, |
| 500 | 500 | ): string { |
| 501 | 501 | // TODO: Update the tokens list and the statement. |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | * the remaining part of the query and the last delimiter |
| 573 | 573 | * @psalm-return array{string|null, string, string|null} |
| 574 | 574 | */ |
| 575 | - public static function getFirstStatement(string $query, string|null $delimiter = null): array |
|
| 575 | + public static function getFirstStatement(string $query, string | null $delimiter = null): array |
|
| 576 | 576 | { |
| 577 | 577 | $lexer = new Lexer($query, false, $delimiter); |
| 578 | 578 | $list = $lexer->list; |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | |
| 597 | 597 | $statement .= $token->token; |
| 598 | 598 | |
| 599 | - if (($token->type === TokenType::Delimiter) && ! empty($token->token)) { |
|
| 599 | + if (($token->type === TokenType::Delimiter) && !empty($token->token)) { |
|
| 600 | 600 | $delimiter = $token->token; |
| 601 | 601 | $fullStatement = true; |
| 602 | 602 | break; |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | |
| 606 | 606 | // No statement was found so we return the entire query as being the |
| 607 | 607 | // remaining part. |
| 608 | - if (! $fullStatement) { |
|
| 608 | + if (!$fullStatement) { |
|
| 609 | 609 | return [ |
| 610 | 610 | null, |
| 611 | 611 | $query, |