@@ -391,28 +391,28 @@ discard block |
||
| 391 | 391 | $expressions = $this->from; |
| 392 | 392 | |
| 393 | 393 | // Adding expressions from JOIN. |
| 394 | - if (! empty($this->join)) { |
|
| 394 | + if (!empty($this->join)) { |
|
| 395 | 395 | foreach ($this->join as $join) { |
| 396 | 396 | $expressions[] = $join->expr; |
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | foreach ($expressions as $expr) { |
| 401 | - if (! isset($expr->table) || ($expr->table === '')) { |
|
| 401 | + if (!isset($expr->table) || ($expr->table === '')) { |
|
| 402 | 402 | continue; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | $thisDb = isset($expr->database) && ($expr->database !== '') ? |
| 406 | 406 | $expr->database : $database; |
| 407 | 407 | |
| 408 | - if (! isset($retval[$thisDb])) { |
|
| 408 | + if (!isset($retval[$thisDb])) { |
|
| 409 | 409 | $retval[$thisDb] = [ |
| 410 | 410 | 'alias' => null, |
| 411 | 411 | 'tables' => [], |
| 412 | 412 | ]; |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - if (! isset($retval[$thisDb]['tables'][$expr->table])) { |
|
| 415 | + if (!isset($retval[$thisDb]['tables'][$expr->table])) { |
|
| 416 | 416 | $retval[$thisDb]['tables'][$expr->table] = [ |
| 417 | 417 | 'alias' => isset($expr->alias) && ($expr->alias !== '') ? |
| 418 | 418 | $expr->alias : null, |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | ]; |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - if (! isset($tables[$thisDb])) { |
|
| 423 | + if (!isset($tables[$thisDb])) { |
|
| 424 | 424 | $tables[$thisDb] = []; |
| 425 | 425 | } |
| 426 | 426 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | foreach ($this->expr as $expr) { |
| 431 | - if (! isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '')) { |
|
| 431 | + if (!isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '')) { |
|
| 432 | 432 | continue; |
| 433 | 433 | } |
| 434 | 434 | |
@@ -20,17 +20,17 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * The type of hint (USE/FORCE/IGNORE) |
| 22 | 22 | */ |
| 23 | - public string|null $type; |
|
| 23 | + public string | null $type; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * What the hint is for (INDEX/KEY) |
| 27 | 27 | */ |
| 28 | - public string|null $indexOrKey; |
|
| 28 | + public string | null $indexOrKey; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * The clause for which this hint is (JOIN/ORDER BY/GROUP BY) |
| 32 | 32 | */ |
| 33 | - public string|null $for; |
|
| 33 | + public string | null $for; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * List of indexes in this hint |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * @param Expression[] $indexes List of indexes in this hint |
| 47 | 47 | */ |
| 48 | 48 | public function __construct( |
| 49 | - string|null $type = null, |
|
| 50 | - string|null $indexOrKey = null, |
|
| 51 | - string|null $for = null, |
|
| 49 | + string | null $type = null, |
|
| 50 | + string | null $indexOrKey = null, |
|
| 51 | + string | null $for = null, |
|
| 52 | 52 | array $indexes = [] |
| 53 | 53 | ) { |
| 54 | 54 | $this->type = $type; |
@@ -300,23 +300,23 @@ discard block |
||
| 300 | 300 | $flags['distinct'] = true; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - if (! empty($statement->group) || ! empty($statement->having)) { |
|
| 303 | + if (!empty($statement->group) || !empty($statement->having)) { |
|
| 304 | 304 | $flags['is_group'] = true; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if (! empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 307 | + if (!empty($statement->into) && ($statement->into->type === 'OUTFILE')) { |
|
| 308 | 308 | $flags['is_export'] = true; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $expressions = $statement->expr; |
| 312 | - if (! empty($statement->join)) { |
|
| 312 | + if (!empty($statement->join)) { |
|
| 313 | 313 | foreach ($statement->join as $join) { |
| 314 | 314 | $expressions[] = $join->expr; |
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | foreach ($expressions as $expr) { |
| 319 | - if (! empty($expr->function)) { |
|
| 319 | + if (!empty($expr->function)) { |
|
| 320 | 320 | if ($expr->function === 'COUNT') { |
| 321 | 321 | $flags['is_count'] = true; |
| 322 | 322 | } elseif (in_array($expr->function, static::$functions)) { |
@@ -331,15 +331,15 @@ discard block |
||
| 331 | 331 | $flags['is_subquery'] = true; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 334 | + if (!empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) { |
|
| 335 | 335 | $flags['is_analyse'] = true; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if (! empty($statement->group)) { |
|
| 338 | + if (!empty($statement->group)) { |
|
| 339 | 339 | $flags['group'] = true; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if (! empty($statement->having)) { |
|
| 342 | + if (!empty($statement->having)) { |
|
| 343 | 343 | $flags['having'] = true; |
| 344 | 344 | } |
| 345 | 345 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $flags['union'] = true; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if (! empty($statement->join)) { |
|
| 350 | + if (!empty($statement->join)) { |
|
| 351 | 351 | $flags['join'] = true; |
| 352 | 352 | } |
| 353 | 353 | |
@@ -438,11 +438,11 @@ discard block |
||
| 438 | 438 | || ($statement instanceof UpdateStatement) |
| 439 | 439 | || ($statement instanceof DeleteStatement) |
| 440 | 440 | ) { |
| 441 | - if (! empty($statement->limit)) { |
|
| 441 | + if (!empty($statement->limit)) { |
|
| 442 | 442 | $flags['limit'] = true; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - if (! empty($statement->order)) { |
|
| 445 | + if (!empty($statement->order)) { |
|
| 446 | 446 | $flags['order'] = true; |
| 447 | 447 | } |
| 448 | 448 | } |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | // Finding tables' aliases and their associated real names. |
| 493 | 493 | $tableAliases = []; |
| 494 | 494 | foreach ($statement->from as $expr) { |
| 495 | - if (! isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 495 | + if (!isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) { |
|
| 496 | 496 | continue; |
| 497 | 497 | } |
| 498 | 498 | |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | ]; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - if (! in_array($arr, $ret['select_tables'])) { |
|
| 520 | + if (!in_array($arr, $ret['select_tables'])) { |
|
| 521 | 521 | $ret['select_tables'][] = $arr; |
| 522 | 522 | } |
| 523 | 523 | } else { |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | // extracted from the FROM clause. |
| 531 | 531 | if ($ret['select_tables'] === []) { |
| 532 | 532 | foreach ($statement->from as $expr) { |
| 533 | - if (! isset($expr->table) || ($expr->table === '')) { |
|
| 533 | + if (!isset($expr->table) || ($expr->table === '')) { |
|
| 534 | 534 | continue; |
| 535 | 535 | } |
| 536 | 536 | |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement)) { |
| 572 | 572 | $expressions = [$statement->table]; |
| 573 | 573 | } elseif ($statement instanceof DropStatement) { |
| 574 | - if (! $statement->options->has('TABLE')) { |
|
| 574 | + if (!$statement->options->has('TABLE')) { |
|
| 575 | 575 | // No tables are dropped. |
| 576 | 576 | return []; |
| 577 | 577 | } |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | |
| 848 | 848 | $statement .= $token->token; |
| 849 | 849 | |
| 850 | - if (($token->type === Token::TYPE_DELIMITER) && ! empty($token->token)) { |
|
| 850 | + if (($token->type === Token::TYPE_DELIMITER) && !empty($token->token)) { |
|
| 851 | 851 | $delimiter = $token->token; |
| 852 | 852 | $fullStatement = true; |
| 853 | 853 | break; |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | |
| 857 | 857 | // No statement was found so we return the entire query as being the |
| 858 | 858 | // remaining part. |
| 859 | - if (! $fullStatement) { |
|
| 859 | + if (!$fullStatement) { |
|
| 860 | 860 | return [ |
| 861 | 861 | null, |
| 862 | 862 | $query, |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @var ArrayObj[]|null |
| 65 | 65 | */ |
| 66 | - public array|null $values = null; |
|
| 66 | + public array | null $values = null; |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * If SET clause is present |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @var SetOperation[]|null |
| 73 | 73 | */ |
| 74 | - public array|null $set = null; |
|
| 74 | + public array | null $set = null; |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * If SELECT clause is present |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * Test for loading closest SQL context |
| 31 | 31 | */ |
| 32 | 32 | #[DataProvider('contextLoadingProvider')] |
| 33 | - public function testLoadClosest(string $context, string|null $expected): void |
|
| 33 | + public function testLoadClosest(string $context, string | null $expected): void |
|
| 34 | 34 | { |
| 35 | 35 | $this->assertEquals($expected, Context::loadClosest($context)); |
| 36 | 36 | if ($expected !== null) { |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | * Test access to string. |
| 87 | 87 | */ |
| 88 | 88 | #[DataProvider('utf8StringsProvider')] |
| 89 | - public function testAccess(string $text, string|null $pos10, string|null $pos20): void |
|
| 89 | + public function testAccess(string $text, string | null $pos10, string | null $pos20): void |
|
| 90 | 90 | { |
| 91 | 91 | $str = new UtfString($text); |
| 92 | 92 | $this->assertEquals($pos10, $str->offsetGet(10)); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @var ArrayObj[]|null |
| 79 | 79 | */ |
| 80 | - public array|null $values = null; |
|
| 80 | + public array | null $values = null; |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * If SET clause is present |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @var SetOperation[]|null |
| 87 | 87 | */ |
| 88 | - public array|null $set = null; |
|
| 88 | + public array | null $set = null; |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * If SELECT clause is present |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @var SetOperation[]|null |
| 111 | 111 | */ |
| 112 | - public array|null $onDuplicateSet = null; |
|
| 112 | + public array | null $onDuplicateSet = null; |
|
| 113 | 113 | |
| 114 | 114 | public function build(): string |
| 115 | 115 | { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | // The code below extracts only the relevant information. |
| 84 | 84 | |
| 85 | 85 | // Extracting lexer's errors. |
| 86 | - if (! empty($lexer->errors)) { |
|
| 86 | + if (!empty($lexer->errors)) { |
|
| 87 | 87 | /** @var LexerException $err */ |
| 88 | 88 | foreach ($lexer->errors as $err) { |
| 89 | 89 | $lexerErrors[] = [ |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Extracting parser's errors. |
| 101 | - if (! empty($parser->errors)) { |
|
| 101 | + if (!empty($parser->errors)) { |
|
| 102 | 102 | /** @var ParserException $err */ |
| 103 | 103 | foreach ($parser->errors as $err) { |
| 104 | 104 | $parserErrors[] = [ |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public static function build($type, $input, $output, $debug = null, $ansi = false): void |
| 137 | 137 | { |
| 138 | 138 | // Support query types: `lexer` / `parser`. |
| 139 | - if (! in_array($type, ['lexer', 'parser'])) { |
|
| 139 | + if (!in_array($type, ['lexer', 'parser'])) { |
|
| 140 | 140 | throw new Exception('Unknown test type (expected `lexer` or `parser`).'); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | 183 | // Remove the project path from .out file, it changes for each dev |
| 184 | - $projectFolder = dirname(__DIR__, 2);// Jump to root |
|
| 184 | + $projectFolder = dirname(__DIR__, 2); // Jump to root |
|
| 185 | 185 | $encoded = str_replace($projectFolder, '<project-root>', $encoded); |
| 186 | 186 | |
| 187 | 187 | file_put_contents($output, $encoded); |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | if (is_dir($inputFile)) { |
| 220 | 220 | // Creating required directories to maintain the structure. |
| 221 | 221 | // Ignoring errors if the folder structure exists already. |
| 222 | - if (! is_dir($outputFile)) { |
|
| 222 | + if (!is_dir($outputFile)) { |
|
| 223 | 223 | mkdir($outputFile); |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if (($debug !== null) && (! is_dir($debugFile))) { |
|
| 226 | + if (($debug !== null) && (!is_dir($debugFile))) { |
|
| 227 | 227 | mkdir($debugFile); |
| 228 | 228 | } |
| 229 | 229 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | // Building the test. |
| 241 | - if (! file_exists($outputFile)) { |
|
| 241 | + if (!file_exists($outputFile)) { |
|
| 242 | 242 | echo sprintf("Building test for %s...\n", $inputFile); |
| 243 | 243 | static::build( |
| 244 | 244 | str_contains($inputFile, 'lex') ? 'lexer' : 'parser', |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @param bool $end whether the end of the buffer was reached |
| 123 | 123 | */ |
| 124 | - public function extract($end = false): string|false |
|
| 124 | + public function extract($end = false): string | false |
|
| 125 | 125 | { |
| 126 | 126 | /** |
| 127 | 127 | * The last parsed position. |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | // Parsing the delimiter. |
| 315 | 315 | $delimiter = ''; |
| 316 | - while (($i < $len) && (! Context::isWhitespace($this->query[$i]))) { |
|
| 316 | + while (($i < $len) && (!Context::isWhitespace($this->query[$i]))) { |
|
| 317 | 317 | $delimiter .= $this->query[$i++]; |
| 318 | 318 | } |
| 319 | 319 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | // Whether this statement should be returned or not. |
| 330 | 330 | $ret = ''; |
| 331 | - if (! empty($this->options['parse_delimiter'])) { |
|
| 331 | + if (!empty($this->options['parse_delimiter'])) { |
|
| 332 | 332 | // Appending the `DELIMITER` statement that was just |
| 333 | 333 | // found to the current statement. |
| 334 | 334 | $ret = trim( |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $ret = $this->current; |
| 372 | 372 | |
| 373 | 373 | // If needed, adds a delimiter at the end of the statement. |
| 374 | - if (! empty($this->options['add_delimiter'])) { |
|
| 374 | + if (!empty($this->options['add_delimiter'])) { |
|
| 375 | 375 | $ret .= $this->delimiter; |
| 376 | 376 | } |
| 377 | 377 | |