@@ -50,7 +50,7 @@ |
||
50 | 50 | */ |
51 | 51 | public static function build($component): string |
52 | 52 | { |
53 | - if (! isset($component->statement)) { |
|
53 | + if (!isset($component->statement)) { |
|
54 | 54 | throw new RuntimeException('No statement inside WITH'); |
55 | 55 | } |
56 | 56 |
@@ -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 |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * Used by all `CREATE` statements. |
282 | 282 | */ |
283 | - public Expression|null $name = null; |
|
283 | + public Expression | null $name = null; |
|
284 | 284 | |
285 | 285 | /** |
286 | 286 | * The options of the entity (table, procedure, function, etc.). |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | public function build(): string |
410 | 410 | { |
411 | 411 | $fields = ''; |
412 | - if (! empty($this->fields)) { |
|
412 | + if (!empty($this->fields)) { |
|
413 | 413 | if (is_array($this->fields)) { |
414 | 414 | $fields = CreateDefinition::buildAll($this->fields) . ' '; |
415 | 415 | } elseif ($this->fields instanceof ArrayObj) { |
@@ -448,23 +448,23 @@ discard block |
||
448 | 448 | |
449 | 449 | $partition = ''; |
450 | 450 | |
451 | - if (! empty($this->partitionBy)) { |
|
451 | + if (!empty($this->partitionBy)) { |
|
452 | 452 | $partition .= "\nPARTITION BY " . $this->partitionBy; |
453 | 453 | } |
454 | 454 | |
455 | - if (! empty($this->partitionsNum)) { |
|
455 | + if (!empty($this->partitionsNum)) { |
|
456 | 456 | $partition .= "\nPARTITIONS " . $this->partitionsNum; |
457 | 457 | } |
458 | 458 | |
459 | - if (! empty($this->subpartitionBy)) { |
|
459 | + if (!empty($this->subpartitionBy)) { |
|
460 | 460 | $partition .= "\nSUBPARTITION BY " . $this->subpartitionBy; |
461 | 461 | } |
462 | 462 | |
463 | - if (! empty($this->subpartitionsNum)) { |
|
463 | + if (!empty($this->subpartitionsNum)) { |
|
464 | 464 | $partition .= "\nSUBPARTITIONS " . $this->subpartitionsNum; |
465 | 465 | } |
466 | 466 | |
467 | - if (! empty($this->partitions)) { |
|
467 | + if (!empty($this->partitions)) { |
|
468 | 468 | $partition .= "\n" . PartitionDefinition::buildAll($this->partitions); |
469 | 469 | } |
470 | 470 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | . OptionsArray::build($this->options) . ' ' |
489 | 489 | . Expression::build($this->name) . ' ' |
490 | 490 | . $fields . ' AS ' . $builtStatement |
491 | - . (! empty($this->body) ? TokensList::build($this->body) : '') . ' ' |
|
491 | + . (!empty($this->body) ? TokensList::build($this->body) : '') . ' ' |
|
492 | 492 | . OptionsArray::build($this->entityOptions); |
493 | 493 | } |
494 | 494 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $token = $list->getNextOfType(Token::TYPE_NUMBER); |
659 | 659 | --$list->idx; // `getNextOfType` also advances one position. |
660 | 660 | $this->subpartitionsNum = $token->value; |
661 | - } elseif (! empty($field)) { |
|
661 | + } elseif (!empty($field)) { |
|
662 | 662 | /* |
663 | 663 | * Handling the content of `PARTITION BY` and `SUBPARTITION BY`. |
664 | 664 | */ |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $field = null; |
688 | 688 | } |
689 | 689 | } elseif (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
690 | - if (! empty($this->partitionBy)) { |
|
690 | + if (!empty($this->partitionBy)) { |
|
691 | 691 | $this->partitions = ArrayObj::parse( |
692 | 692 | $parser, |
693 | 693 | $list, |
@@ -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)); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | { |
189 | 189 | $this->str = $str; |
190 | 190 | $this->byteLen = mb_strlen($str, '8bit'); |
191 | - if (! mb_check_encoding($str, 'UTF-8')) { |
|
191 | + if (!mb_check_encoding($str, 'UTF-8')) { |
|
192 | 192 | $this->charLen = 0; |
193 | 193 | } else { |
194 | 194 | $this->charLen = mb_strlen($str, 'UTF-8'); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @param int $offset the offset to be returned |
212 | 212 | */ |
213 | - public function offsetGet($offset): string|null |
|
213 | + public function offsetGet($offset): string | null |
|
214 | 214 | { |
215 | 215 | if (($offset < 0) || ($offset >= $this->charLen)) { |
216 | 216 | return null; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | // Use the default ASCII map as queries are mostly ASCII chars |
287 | 287 | // ord($byte) has a performance cost |
288 | 288 | |
289 | - if (! isset(static::$asciiMap[$byte])) { |
|
289 | + if (!isset(static::$asciiMap[$byte])) { |
|
290 | 290 | // Complete the cache with missing items |
291 | 291 | static::$asciiMap[$byte] = ord($byte); |
292 | 292 | } |
@@ -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 |