@@ -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 |
@@ -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 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * Gets the next token. Skips any irrelevant token (whitespaces and |
95 | 95 | * comments). |
96 | 96 | */ |
97 | - public function getNext(): Token|null |
|
97 | + public function getNext(): Token | null |
|
98 | 98 | { |
99 | 99 | for (; $this->idx < $this->count; ++$this->idx) { |
100 | 100 | if ( |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * Gets the previous token. Skips any irrelevant token (whitespaces and |
113 | 113 | * comments). |
114 | 114 | */ |
115 | - public function getPrevious(): Token|null |
|
115 | + public function getPrevious(): Token | null |
|
116 | 116 | { |
117 | 117 | for (; $this->idx >= 0; --$this->idx) { |
118 | 118 | if ( |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @param int|int[] $type the type |
133 | 133 | */ |
134 | - public function getPreviousOfType($type): Token|null |
|
134 | + public function getPreviousOfType($type): Token | null |
|
135 | 135 | { |
136 | - if (! is_array($type)) { |
|
136 | + if (!is_array($type)) { |
|
137 | 137 | $type = [$type]; |
138 | 138 | } |
139 | 139 | |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @param int|int[] $type the type |
153 | 153 | */ |
154 | - public function getNextOfType($type): Token|null |
|
154 | + public function getNextOfType($type): Token | null |
|
155 | 155 | { |
156 | - if (! is_array($type)) { |
|
156 | + if (!is_array($type)) { |
|
157 | 157 | $type = [$type]; |
158 | 158 | } |
159 | 159 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param int $type the type of the token |
173 | 173 | * @param string $value the value of the token |
174 | 174 | */ |
175 | - public function getNextOfTypeAndValue($type, $value): Token|null |
|
175 | + public function getNextOfTypeAndValue($type, $value): Token | null |
|
176 | 176 | { |
177 | 177 | for (; $this->idx < $this->count; ++$this->idx) { |
178 | 178 | if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->value === $value)) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @param int $type the type of the token |
190 | 190 | * @param int $flag the flag of the token |
191 | 191 | */ |
192 | - public function getNextOfTypeAndFlag(int $type, int $flag): Token|null |
|
192 | + public function getNextOfTypeAndFlag(int $type, int $flag): Token | null |
|
193 | 193 | { |
194 | 194 | for (; $this->idx < $this->count; ++$this->idx) { |
195 | 195 | if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->flags === $flag)) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @param int $offset the offset to be returned |
222 | 222 | */ |
223 | - public function offsetGet($offset): Token|null |
|
223 | + public function offsetGet($offset): Token | null |
|
224 | 224 | { |
225 | 225 | return $offset < $this->count ? $this->tokens[$offset] : null; |
226 | 226 | } |
@@ -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 |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param TokensList $list the list of tokens that are being parsed |
95 | 95 | * @param array<string, mixed> $options parameters for parsing |
96 | 96 | */ |
97 | - public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null |
|
97 | + public static function parse(Parser $parser, TokensList $list, array $options = []): DataType | null |
|
98 | 98 | { |
99 | 99 | $ret = new static(); |
100 | 100 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | if ($state === 0) { |
126 | 126 | $ret->name = strtoupper((string) $token->value); |
127 | - if (($token->type !== Token::TYPE_KEYWORD) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
127 | + if (($token->type !== Token::TYPE_KEYWORD) || (!($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
128 | 128 | $parser->error('Unrecognized data type.', $token); |
129 | 129 | } |
130 | 130 |