@@ -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 |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | * @param string|null $alias the name of the alias |
112 | 112 | */ |
113 | 113 | public function __construct( |
114 | - string|null $database = null, |
|
115 | - string|null $table = null, |
|
116 | - string|null $column = null, |
|
117 | - string|null $alias = null |
|
114 | + string | null $database = null, |
|
115 | + string | null $table = null, |
|
116 | + string | null $column = null, |
|
117 | + string | null $alias = null |
|
118 | 118 | ) { |
119 | 119 | if (($column === null) && ($alias === null)) { |
120 | 120 | $this->expr = $database; // case 1 |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @throws ParserException |
161 | 161 | */ |
162 | - public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null |
|
162 | + public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null |
|
163 | 163 | { |
164 | 164 | $ret = new static(); |
165 | 165 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | ]; |
203 | 203 | |
204 | 204 | // When a field is parsed, no parentheses are expected. |
205 | - if (! empty($options['parseField'])) { |
|
205 | + if (!empty($options['parseField'])) { |
|
206 | 206 | $options['breakOnParentheses'] = true; |
207 | 207 | $options['field'] = $options['parseField']; |
208 | 208 | } |
@@ -229,14 +229,14 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | if ($token->type === TokenType::Keyword) { |
232 | - if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
232 | + if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
233 | 233 | // A `(` was previously found and this keyword is the |
234 | 234 | // beginning of a statement, so this is a subquery. |
235 | 235 | $ret->subquery = $token->keyword; |
236 | 236 | } elseif ( |
237 | 237 | ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
238 | 238 | && (empty($options['parseField']) |
239 | - && ! $alias) |
|
239 | + && !$alias) |
|
240 | 240 | ) { |
241 | 241 | $isExpr = true; |
242 | 242 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | } |
249 | 249 | |
250 | 250 | if ($token->keyword === 'AS') { |
251 | - if (! empty($options['breakOnAlias'])) { |
|
251 | + if (!empty($options['breakOnAlias'])) { |
|
252 | 252 | break; |
253 | 253 | } |
254 | 254 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | $isExpr = true; |
274 | - } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) { |
|
274 | + } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) { |
|
275 | 275 | /* End of expression */ |
276 | 276 | break; |
277 | 277 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | || (($token->type === TokenType::Operator) |
288 | 288 | && ($token->value !== '.')) |
289 | 289 | ) { |
290 | - if (! empty($options['parseField'])) { |
|
290 | + if (!empty($options['parseField'])) { |
|
291 | 291 | break; |
292 | 292 | } |
293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | if ($token->type === TokenType::Operator) { |
300 | - if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
300 | + if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
301 | 301 | // No brackets were expected. |
302 | 302 | break; |
303 | 303 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | --$brackets; |
323 | 323 | if ($brackets === 0) { |
324 | - if (! empty($options['parenthesesDelimited'])) { |
|
324 | + if (!empty($options['parenthesesDelimited'])) { |
|
325 | 325 | // The current token is the last bracket, the next |
326 | 326 | // one will be outside the expression. |
327 | 327 | $ret->expr .= $token->token; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | if ($alias) { |
349 | 349 | // An alias is expected (the keyword `AS` was previously found). |
350 | - if (! empty($ret->alias)) { |
|
350 | + if (!empty($ret->alias)) { |
|
351 | 351 | $parser->error('An alias was previously found.', $token); |
352 | 352 | break; |
353 | 353 | } |
@@ -361,15 +361,15 @@ discard block |
||
361 | 361 | && ($prev[0] === null |
362 | 362 | || (($prev[0]->type !== TokenType::Operator || $prev[0]->token === ')') |
363 | 363 | && ($prev[0]->type !== TokenType::Keyword |
364 | - || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
364 | + || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
365 | 365 | && (($prev[1]->type === TokenType::String) |
366 | 366 | || ($prev[1]->type === TokenType::Symbol |
367 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
368 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER)) |
|
367 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
368 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER)) |
|
369 | 369 | || ($prev[1]->type === TokenType::None |
370 | 370 | && $prev[1]->token !== 'OVER')) |
371 | 371 | ) { |
372 | - if (! empty($ret->alias)) { |
|
372 | + if (!empty($ret->alias)) { |
|
373 | 373 | $parser->error('An alias was previously found.', $token); |
374 | 374 | break; |
375 | 375 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | // Found a `.` which means we expect a column name and |
401 | 401 | // the column name we parsed is actually the table name |
402 | 402 | // and the table name is actually a database name. |
403 | - if (! empty($ret->database) || $dot) { |
|
403 | + if (!empty($ret->database) || $dot) { |
|
404 | 404 | $parser->error('Unexpected dot.', $token); |
405 | 405 | } |
406 | 406 | |
@@ -417,11 +417,11 @@ discard block |
||
417 | 417 | $dot = false; |
418 | 418 | } else { |
419 | 419 | // No alias is expected. |
420 | - if (! empty($options['breakOnAlias'])) { |
|
420 | + if (!empty($options['breakOnAlias'])) { |
|
421 | 421 | break; |
422 | 422 | } |
423 | 423 | |
424 | - if (! empty($ret->alias)) { |
|
424 | + if (!empty($ret->alias)) { |
|
425 | 425 | $parser->error('An alias was previously found.', $token); |
426 | 426 | break; |
427 | 427 | } |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $ret = implode('.', Context::escapeAll($fields)); |
470 | 470 | } |
471 | 471 | |
472 | - if (! empty($this->alias)) { |
|
472 | + if (!empty($this->alias)) { |
|
473 | 473 | $ret .= ' AS ' . Context::escape($this->alias); |
474 | 474 | } |
475 | 475 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $inOut parameter's directional type (IN / OUT or None) |
45 | 45 | * @param DataType $type parameter's type |
46 | 46 | */ |
47 | - public function __construct(string|null $name = null, string|null $inOut = null, DataType|null $type = null) |
|
47 | + public function __construct(string | null $name = null, string | null $inOut = null, DataType | null $type = null) |
|
48 | 48 | { |
49 | 49 | $this->name = $name; |
50 | 50 | $this->inOut = $inOut; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function build(): string |
143 | 143 | { |
144 | 144 | $tmp = ''; |
145 | - if (! empty($this->inOut)) { |
|
145 | + if (!empty($this->inOut)) { |
|
146 | 146 | $tmp .= $this->inOut . ' '; |
147 | 147 | } |
148 | 148 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | * @param string[] $columns the columns referenced |
63 | 63 | * @param OptionsArray $options the options |
64 | 64 | */ |
65 | - public function __construct(Expression|null $table = null, array $columns = [], OptionsArray|null $options = null) |
|
65 | + public function __construct(Expression | null $table = null, array $columns = [], OptionsArray | null $options = null) |
|
66 | 66 | { |
67 | 67 | $this->table = $table; |
68 | 68 | $this->columns = $columns; |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | * @phpstan-param array{name?: string, length?: int, order?: string}[] $columns |
106 | 106 | */ |
107 | 107 | public function __construct( |
108 | - string|null $name = null, |
|
108 | + string | null $name = null, |
|
109 | 109 | array $columns = [], |
110 | - string|null $type = null, |
|
111 | - OptionsArray|null $options = null |
|
110 | + string | null $type = null, |
|
111 | + OptionsArray | null $options = null |
|
112 | 112 | ) { |
113 | 113 | $this->name = $name; |
114 | 114 | $this->columns = $columns; |
@@ -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 |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @param OptionsArray $options the options of this data type |
79 | 79 | */ |
80 | 80 | public function __construct( |
81 | - string|null $name = null, |
|
81 | + string | null $name = null, |
|
82 | 82 | array $parameters = [], |
83 | - OptionsArray|null $options = null |
|
83 | + OptionsArray | null $options = null |
|
84 | 84 | ) { |
85 | 85 | $this->name = $name; |
86 | 86 | $this->parameters = $parameters; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param TokensList $list the list of tokens that are being parsed |
93 | 93 | * @param array<string, mixed> $options parameters for parsing |
94 | 94 | */ |
95 | - public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null |
|
95 | + public static function parse(Parser $parser, TokensList $list, array $options = []): DataType | null |
|
96 | 96 | { |
97 | 97 | $ret = new static(); |
98 | 98 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | if ($state === 0) { |
124 | 124 | $ret->name = strtoupper((string) $token->value); |
125 | - if (($token->type !== TokenType::Keyword) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
125 | + if (($token->type !== TokenType::Keyword) || (!($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
126 | 126 | $parser->error('Unrecognized data type.', $token); |
127 | 127 | } |
128 | 128 |