@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @throws ParserException |
156 | 156 | */ |
157 | - public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null |
|
157 | + public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null |
|
158 | 158 | { |
159 | 159 | $ret = new static(); |
160 | 160 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | ]; |
198 | 198 | |
199 | 199 | // When a field is parsed, no parentheses are expected. |
200 | - if (! empty($options['parseField'])) { |
|
200 | + if (!empty($options['parseField'])) { |
|
201 | 201 | $options['breakOnParentheses'] = true; |
202 | 202 | $options['field'] = $options['parseField']; |
203 | 203 | } |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | if ($token->type === Token::TYPE_KEYWORD) { |
227 | - if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
227 | + if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
228 | 228 | // A `(` was previously found and this keyword is the |
229 | 229 | // beginning of a statement, so this is a subquery. |
230 | 230 | $ret->subquery = $token->keyword; |
231 | 231 | } elseif ( |
232 | 232 | ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
233 | 233 | && (empty($options['parseField']) |
234 | - && ! $alias) |
|
234 | + && !$alias) |
|
235 | 235 | ) { |
236 | 236 | $isExpr = true; |
237 | 237 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | if ($token->keyword === 'AS') { |
246 | - if (! empty($options['breakOnAlias'])) { |
|
246 | + if (!empty($options['breakOnAlias'])) { |
|
247 | 247 | break; |
248 | 248 | } |
249 | 249 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | } |
267 | 267 | |
268 | 268 | $isExpr = true; |
269 | - } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) { |
|
269 | + } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) { |
|
270 | 270 | /* End of expression */ |
271 | 271 | break; |
272 | 272 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | || (($token->type === Token::TYPE_OPERATOR) |
283 | 283 | && ($token->value !== '.')) |
284 | 284 | ) { |
285 | - if (! empty($options['parseField'])) { |
|
285 | + if (!empty($options['parseField'])) { |
|
286 | 286 | break; |
287 | 287 | } |
288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | if ($token->type === Token::TYPE_OPERATOR) { |
295 | - if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
295 | + if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
296 | 296 | // No brackets were expected. |
297 | 297 | break; |
298 | 298 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | |
317 | 317 | --$brackets; |
318 | 318 | if ($brackets === 0) { |
319 | - if (! empty($options['parenthesesDelimited'])) { |
|
319 | + if (!empty($options['parenthesesDelimited'])) { |
|
320 | 320 | // The current token is the last bracket, the next |
321 | 321 | // one will be outside the expression. |
322 | 322 | $ret->expr .= $token->token; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | if ($alias) { |
344 | 344 | // An alias is expected (the keyword `AS` was previously found). |
345 | - if (! empty($ret->alias)) { |
|
345 | + if (!empty($ret->alias)) { |
|
346 | 346 | $parser->error('An alias was previously found.', $token); |
347 | 347 | break; |
348 | 348 | } |
@@ -356,14 +356,14 @@ discard block |
||
356 | 356 | && ($prev[0] === null |
357 | 357 | || (($prev[0]->type !== Token::TYPE_OPERATOR || $prev[0]->token === ')') |
358 | 358 | && ($prev[0]->type !== Token::TYPE_KEYWORD |
359 | - || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
359 | + || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
360 | 360 | && (($prev[1]->type === Token::TYPE_STRING) |
361 | 361 | || ($prev[1]->type === Token::TYPE_SYMBOL |
362 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
362 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
363 | 363 | || ($prev[1]->type === Token::TYPE_NONE |
364 | 364 | && $prev[1]->token !== 'OVER')) |
365 | 365 | ) { |
366 | - if (! empty($ret->alias)) { |
|
366 | + if (!empty($ret->alias)) { |
|
367 | 367 | $parser->error('An alias was previously found.', $token); |
368 | 368 | break; |
369 | 369 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | // Found a `.` which means we expect a column name and |
395 | 395 | // the column name we parsed is actually the table name |
396 | 396 | // and the table name is actually a database name. |
397 | - if (! empty($ret->database) || $dot) { |
|
397 | + if (!empty($ret->database) || $dot) { |
|
398 | 398 | $parser->error('Unexpected dot.', $token); |
399 | 399 | } |
400 | 400 | |
@@ -411,11 +411,11 @@ discard block |
||
411 | 411 | $dot = false; |
412 | 412 | } else { |
413 | 413 | // No alias is expected. |
414 | - if (! empty($options['breakOnAlias'])) { |
|
414 | + if (!empty($options['breakOnAlias'])) { |
|
415 | 415 | break; |
416 | 416 | } |
417 | 417 | |
418 | - if (! empty($ret->alias)) { |
|
418 | + if (!empty($ret->alias)) { |
|
419 | 419 | $parser->error('An alias was previously found.', $token); |
420 | 420 | break; |
421 | 421 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | $ret = implode('.', Context::escapeAll($fields)); |
464 | 464 | } |
465 | 465 | |
466 | - if (! empty($this->alias)) { |
|
466 | + if (!empty($this->alias)) { |
|
467 | 467 | $ret .= ' AS ' . Context::escape($this->alias); |
468 | 468 | } |
469 | 469 |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | } elseif (($token->value === ',') && ($brackets === 0)) { |
408 | 408 | break; |
409 | 409 | } |
410 | - } elseif (! self::checkIfTokenQuotedSymbol($token)) { |
|
410 | + } elseif (!self::checkIfTokenQuotedSymbol($token)) { |
|
411 | 411 | // If the current token is "SET" or "ENUM", we want to avoid the token between their parenthesis in |
412 | 412 | // the unknown tokens. |
413 | 413 | if (in_array($token->value, ['SET', 'ENUM'], true)) { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | ); |
427 | 427 | break; |
428 | 428 | } |
429 | - } elseif (! empty(Parser::STATEMENT_PARSERS[$arrayKey])) { |
|
429 | + } elseif (!empty(Parser::STATEMENT_PARSERS[$arrayKey])) { |
|
430 | 430 | // We have reached the end of ALTER operation and suddenly found |
431 | 431 | // a start to new statement, but have not found a delimiter between them |
432 | 432 | $parser->error( |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | } elseif ( |
438 | 438 | (array_key_exists($arrayKey, self::DATABASE_OPTIONS) |
439 | 439 | || array_key_exists($arrayKey, self::TABLE_OPTIONS)) |
440 | - && ! self::checkIfColumnDefinitionKeyword($arrayKey) |
|
440 | + && !self::checkIfColumnDefinitionKeyword($arrayKey) |
|
441 | 441 | ) { |
442 | 442 | // This alter operation has finished, which means a comma |
443 | 443 | // was missing before start of new alter operation |