@@ -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 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public static function getForeignKeys($statement): array |
25 | 25 | { |
26 | - if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) { |
|
26 | + if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) { |
|
27 | 27 | return []; |
28 | 28 | } |
29 | 29 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $columns = []; |
38 | 38 | foreach ($field->key->columns as $column) { |
39 | - if (! isset($column['name'])) { |
|
39 | + if (!isset($column['name'])) { |
|
40 | 40 | continue; |
41 | 41 | } |
42 | 42 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'index_list' => $columns, |
49 | 49 | ]; |
50 | 50 | |
51 | - if (! empty($field->references)) { |
|
51 | + if (!empty($field->references)) { |
|
52 | 52 | $tmp['ref_db_name'] = $field->references->table->database; |
53 | 53 | $tmp['ref_table_name'] = $field->references->table->table; |
54 | 54 | $tmp['ref_index_list'] = $field->references->columns; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public static function getFields($statement): array |
83 | 83 | { |
84 | - if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) { |
|
84 | + if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) { |
|
85 | 85 | return []; |
86 | 86 | } |
87 | 87 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'timestamp_not_null' => false, |
99 | 99 | ]; |
100 | 100 | |
101 | - if (! $field->options) { |
|
101 | + if (!$field->options) { |
|
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $option = $field->options->has('AS'); |
127 | 127 | |
128 | - if (! $option) { |
|
128 | + if (!$option) { |
|
129 | 129 | continue; |
130 | 130 | } |
131 | 131 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | */ |
66 | 66 | public static function gettext($msgid): string |
67 | 67 | { |
68 | - if (! class_exists(Loader::class, true)) { |
|
68 | + if (!class_exists(Loader::class, true)) { |
|
69 | 69 | return $msgid; |
70 | 70 | } |
71 | 71 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @return ArrayObj|Component[] |
51 | 51 | */ |
52 | - public static function parse(Parser $parser, TokensList $list, array $options = []): ArrayObj|array |
|
52 | + public static function parse(Parser $parser, TokensList $list, array $options = []): ArrayObj | array |
|
53 | 53 | { |
54 | 54 | $ret = empty($options['type']) ? new static() : []; |
55 | 55 |
@@ -358,13 +358,13 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param bool $isReserved checks if the keyword is reserved |
360 | 360 | */ |
361 | - public static function isKeyword(string $string, bool $isReserved = false): int|null |
|
361 | + public static function isKeyword(string $string, bool $isReserved = false): int | null |
|
362 | 362 | { |
363 | 363 | $upperString = strtoupper($string); |
364 | 364 | |
365 | 365 | if ( |
366 | - ! isset(static::$keywords[$upperString]) |
|
367 | - || ($isReserved && ! (static::$keywords[$upperString] & Token::FLAG_KEYWORD_RESERVED)) |
|
366 | + !isset(static::$keywords[$upperString]) |
|
367 | + || ($isReserved && !(static::$keywords[$upperString] & Token::FLAG_KEYWORD_RESERVED)) |
|
368 | 368 | ) { |
369 | 369 | return null; |
370 | 370 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | /** |
376 | 376 | * Checks if the given string is an operator and returns the appropriate flag for the operator. |
377 | 377 | */ |
378 | - public static function isOperator(string $string): int|null |
|
378 | + public static function isOperator(string $string): int | null |
|
379 | 379 | { |
380 | 380 | return static::$operators[$string] ?? null; |
381 | 381 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return int|null the appropriate flag for the comment type |
395 | 395 | */ |
396 | - public static function isComment(string $string, bool $end = false): int|null |
|
396 | + public static function isComment(string $string, bool $end = false): int | null |
|
397 | 397 | { |
398 | 398 | if ($string === '') { |
399 | 399 | return null; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return int|null the appropriate flag for the symbol type |
458 | 458 | */ |
459 | - public static function isSymbol(string $string): int|null |
|
459 | + public static function isSymbol(string $string): int | null |
|
460 | 460 | { |
461 | 461 | if ($string === '') { |
462 | 462 | return null; |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | * |
485 | 485 | * @return int|null the appropriate flag for the string type |
486 | 486 | */ |
487 | - public static function isString(string $string): int|null |
|
487 | + public static function isString(string $string): int | null |
|
488 | 488 | { |
489 | 489 | if ($string === '') { |
490 | 490 | return null; |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $context = self::$contextPrefix . $context; |
539 | 539 | } |
540 | 540 | |
541 | - if (! class_exists($context)) { |
|
541 | + if (!class_exists($context)) { |
|
542 | 542 | return false; |
543 | 543 | } |
544 | 544 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @return string|null The loaded context. `null` if no context was loaded. |
562 | 562 | */ |
563 | - public static function loadClosest(string $context = ''): string|null |
|
563 | + public static function loadClosest(string $context = ''): string | null |
|
564 | 564 | { |
565 | 565 | $length = strlen($context); |
566 | 566 | for ($i = $length; $i > 0;) { |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | $i -= 2; |
575 | 575 | $part = substr($context, $i, 2); |
576 | 576 | /* No more numeric parts to strip */ |
577 | - if (! is_numeric($part)) { |
|
577 | + if (!is_numeric($part)) { |
|
578 | 578 | break 2; |
579 | 579 | } |
580 | 580 | } while (intval($part) === 0 && $i > 0); |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | public static function escape(string $str, string $quote = '`'): string |
676 | 676 | { |
677 | 677 | if ( |
678 | - (static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && ! ( |
|
678 | + (static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && !( |
|
679 | 679 | static::isKeyword($str, true) || self::doesIdentifierRequireQuoting($str) |
680 | 680 | ) |
681 | 681 | ) { |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * |
723 | 723 | * @return bool false on empty param, true/false on given constant/int value |
724 | 724 | */ |
725 | - public static function hasMode(int|null $flag = null): bool |
|
725 | + public static function hasMode(int | null $flag = null): bool |
|
726 | 726 | { |
727 | 727 | if (empty($flag)) { |
728 | 728 | return false; |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $this->assertEquals([ |
44 | 44 | TokenType::Keyword->value | Token::FLAG_KEYWORD_RESERVED => [ |
45 | 45 | 8 => ['RESERVED'], |
46 | - 9 => ['RESERVED2','RESERVED3','RESERVED4','RESERVED5'], |
|
46 | + 9 => ['RESERVED2', 'RESERVED3', 'RESERVED4', 'RESERVED5'], |
|
47 | 47 | ], |
48 | 48 | TokenType::Keyword->value | Token::FLAG_KEYWORD_FUNCTION => [8 => ['FUNCTION']], |
49 | 49 | TokenType::Keyword->value | Token::FLAG_KEYWORD_DATA_TYPE => [8 => ['DATATYPE']], |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | switch ($this->type) { |
129 | 129 | case TokenType::Keyword: |
130 | 130 | $this->keyword = strtoupper($this->token); |
131 | - if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) { |
|
131 | + if (!($this->flags & self::FLAG_KEYWORD_RESERVED)) { |
|
132 | 132 | // Unreserved keywords should stay the way they are because they |
133 | 133 | // might represent field names. |
134 | 134 | return $this->token; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | } elseif (($this->flags & self::FLAG_NUMBER_APPROXIMATE) || ($this->flags & self::FLAG_NUMBER_FLOAT)) { |
155 | 155 | $ret = (float) $ret; |
156 | - } elseif (! ($this->flags & self::FLAG_NUMBER_BINARY)) { |
|
156 | + } elseif (!($this->flags & self::FLAG_NUMBER_BINARY)) { |
|
157 | 157 | $ret = (int) $ret; |
158 | 158 | } |
159 | 159 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // in PHP 5.3- the `null` parameter isn't handled correctly. |
189 | 189 | $str = mb_substr( |
190 | 190 | $str, |
191 | - ! empty($str[1]) && ($str[1] === '@') ? 2 : 1, |
|
191 | + !empty($str[1]) && ($str[1] === '@') ? 2 : 1, |
|
192 | 192 | mb_strlen($str), |
193 | 193 | 'UTF-8' |
194 | 194 | ); |