@@ -54,7 +54,7 @@ |
||
54 | 54 | |
55 | 55 | /** @param GroupKeyword|array<GroupKeyword> $component */ |
56 | 56 | #[DataProvider('provideExpressions')] |
57 | - public function testBuild(GroupKeyword|array $component, string $expected): void |
|
57 | + public function testBuild(GroupKeyword | array $component, string $expected): void |
|
58 | 58 | { |
59 | 59 | if (is_array($component)) { |
60 | 60 | $this->assertSame($expected, GroupKeywords::buildAll($component)); |
@@ -18,5 +18,5 @@ |
||
18 | 18 | * |
19 | 19 | * @return Component|Component[]|null |
20 | 20 | */ |
21 | - public static function parse(Parser $parser, TokensList $list, array $options = []): Component|array|null; |
|
21 | + public static function parse(Parser $parser, TokensList $list, array $options = []): Component | array | null; |
|
22 | 22 | } |
@@ -63,23 +63,23 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @see Statement::$statementOptions |
65 | 65 | */ |
66 | - public OptionsArray|null $options = null; |
|
66 | + public OptionsArray | null $options = null; |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * The index of the first token used in this statement. |
70 | 70 | */ |
71 | - public int|null $first = null; |
|
71 | + public int | null $first = null; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * The index of the last token used in this statement. |
75 | 75 | */ |
76 | - public int|null $last = null; |
|
76 | + public int | null $last = null; |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @param Parser|null $parser the instance that requests parsing |
80 | 80 | * @param TokensList|null $list the list of tokens to be parsed |
81 | 81 | */ |
82 | - public function __construct(Parser|null $parser = null, TokensList|null $list = null) |
|
82 | + public function __construct(Parser | null $parser = null, TokensList | null $list = null) |
|
83 | 83 | { |
84 | 84 | if (($parser === null) || ($list === null)) { |
85 | 85 | return; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | // Checking if this field was already built. |
126 | 126 | if ($type & self::ADD_CLAUSE) { |
127 | - if (! empty($built[$field])) { |
|
127 | + if (!empty($built[$field])) { |
|
128 | 128 | continue; |
129 | 129 | } |
130 | 130 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | // Checking if the result of the builder should be added. |
140 | - if (! ($type & self::ADD_CLAUSE)) { |
|
140 | + if (!($type & self::ADD_CLAUSE)) { |
|
141 | 141 | continue; |
142 | 142 | } |
143 | 143 | |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | $options = []; |
261 | 261 | |
262 | 262 | // Looking for duplicated clauses. |
263 | - if (isset(Parser::KEYWORD_PARSERS[$token->value]) || ! empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
264 | - if (! empty($parsedClauses[$token->value])) { |
|
263 | + if (isset(Parser::KEYWORD_PARSERS[$token->value]) || !empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
264 | + if (!empty($parsedClauses[$token->value])) { |
|
265 | 265 | $parser->error('This type of clause was previously parsed.', $token); |
266 | 266 | break; |
267 | 267 | } |
@@ -277,15 +277,15 @@ discard block |
||
277 | 277 | if (isset(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) { |
278 | 278 | $class = Parser::KEYWORD_PARSERS[$tokenValue]['class']; |
279 | 279 | $field = Parser::KEYWORD_PARSERS[$tokenValue]['field']; |
280 | - if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
280 | + if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
281 | 281 | $options = Parser::KEYWORD_PARSERS[$tokenValue]['options']; |
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
285 | 285 | // Checking if this is the beginning of the statement. |
286 | - if (! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
286 | + if (!empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
287 | 287 | if ( |
288 | - ! empty(static::$clauses) // Undefined for some statements. |
|
288 | + !empty(static::$clauses) // Undefined for some statements. |
|
289 | 289 | && empty(static::$clauses[$token->value]) |
290 | 290 | ) { |
291 | 291 | // Some keywords (e.g. `SET`) may be the beginning of a |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | break; |
301 | 301 | } |
302 | 302 | |
303 | - if (! $parsedOptions) { |
|
304 | - if (! array_key_exists((string) $token->value, static::$statementOptions)) { |
|
303 | + if (!$parsedOptions) { |
|
304 | + if (!array_key_exists((string) $token->value, static::$statementOptions)) { |
|
305 | 305 | // Skipping keyword because if it is not a option. |
306 | 306 | ++$list->idx; |
307 | 307 | } |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | if ($minJoin === 0 && stripos($clauseType, 'JOIN')) { |
469 | 469 | // First JOIN clause is detected |
470 | 470 | $minJoin = $maxJoin = $clauseStartIdx; |
471 | - } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) { |
|
471 | + } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) { |
|
472 | 472 | // After a previous JOIN clause, a non-JOIN clause has been detected |
473 | 473 | $maxJoin = $lastIdx; |
474 | 474 | } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $state = 4; |
171 | 171 | } elseif ($token->type === TokenType::Symbol || $token->type === TokenType::None) { |
172 | 172 | $expr->name = $token->value; |
173 | - if (! $expr->isConstraint) { |
|
173 | + if (!$expr->isConstraint) { |
|
174 | 174 | $state = 2; |
175 | 175 | } |
176 | 176 | } elseif ($token->type === TokenType::Keyword) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | |
212 | 212 | $state = 5; |
213 | 213 | } else { |
214 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
214 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
215 | 215 | $ret[] = $expr; |
216 | 216 | } |
217 | 217 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | // Last iteration was not saved. |
234 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
234 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
235 | 235 | $ret[] = $expr; |
236 | 236 | } |
237 | 237 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | if ($lastOption === null) { |
89 | 89 | $upper = strtoupper($token->token); |
90 | - if (! isset($options[$upper])) { |
|
90 | + if (!isset($options[$upper])) { |
|
91 | 91 | // There is no option to be processed. |
92 | 92 | break; |
93 | 93 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($state === 0) { |
127 | - if (! is_array($lastOption)) { |
|
127 | + if (!is_array($lastOption)) { |
|
128 | 128 | // This is a just keyword option without any value. |
129 | 129 | // This is the beginning and the end of it. |
130 | 130 | $ret->options[$lastOptionId] = $token->value; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $ret->options[$lastOptionId]['expr'] .= $token->token; |
202 | 202 | |
203 | 203 | if ( |
204 | - ! (($token->token === '(') && ($brackets === 1) |
|
204 | + !(($token->token === '(') && ($brackets === 1) |
|
205 | 205 | || (($token->token === ')') && ($brackets === 0))) |
206 | 206 | ) { |
207 | 207 | // First pair of brackets is being skipped. |
@@ -27,7 +27,7 @@ |
||
27 | 27 | * |
28 | 28 | * @return ArrayObj|Component[] |
29 | 29 | */ |
30 | - public static function parse(Parser $parser, TokensList $list, array $options = []): ArrayObj|array |
|
30 | + public static function parse(Parser $parser, TokensList $list, array $options = []): ArrayObj | array |
|
31 | 31 | { |
32 | 32 | $ret = empty($options['type']) ? new ArrayObj() : []; |
33 | 33 |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | } elseif (($token->value === ',') && ($brackets === 0)) { |
402 | 402 | break; |
403 | 403 | } |
404 | - } elseif (! self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) { |
|
404 | + } elseif (!self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) { |
|
405 | 405 | if (isset(Parser::STATEMENT_PARSERS[$arrayKey]) && Parser::STATEMENT_PARSERS[$arrayKey] !== '') { |
406 | 406 | $list->idx++; // Ignore the current token |
407 | 407 | $nextToken = $list->getNext(); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | } elseif ( |
425 | 425 | (array_key_exists($arrayKey, self::DATABASE_OPTIONS) |
426 | 426 | || array_key_exists($arrayKey, self::TABLE_OPTIONS)) |
427 | - && ! self::checkIfColumnDefinitionKeyword($arrayKey) |
|
427 | + && !self::checkIfColumnDefinitionKeyword($arrayKey) |
|
428 | 428 | ) { |
429 | 429 | // This alter operation has finished, which means a comma |
430 | 430 | // was missing before start of new alter operation |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | // Handle optional AS keyword before alias |
201 | 201 | if ($token->type === TokenType::Keyword && $token->keyword === 'AS') { |
202 | - if ($asFound || ! empty($ret->alias)) { |
|
202 | + if ($asFound || !empty($ret->alias)) { |
|
203 | 203 | $parser->error('Potential duplicate alias of CASE expression.', $token); |
204 | 204 | break; |
205 | 205 | } |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | if ( |
222 | 222 | $asFound |
223 | 223 | || $token->type === TokenType::String |
224 | - || ($token->type === TokenType::Symbol && ! $token->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
224 | + || ($token->type === TokenType::Symbol && !$token->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
225 | 225 | || $token->type === TokenType::None |
226 | 226 | ) { |
227 | 227 | // An alias is expected (the keyword `AS` was previously found). |
228 | - if (! empty($ret->alias)) { |
|
228 | + if (!empty($ret->alias)) { |
|
229 | 229 | $parser->error('An alias was previously found.', $token); |
230 | 230 | break; |
231 | 231 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param TokensList $list the list of tokens that are being parsed |
45 | 45 | * @param array<string, mixed> $options parameters for parsing |
46 | 46 | */ |
47 | - public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null |
|
47 | + public static function parse(Parser $parser, TokensList $list, array $options = []): DataType | null |
|
48 | 48 | { |
49 | 49 | $ret = new DataType(); |
50 | 50 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | if ($state === 0) { |
74 | 74 | $ret->name = strtoupper((string) $token->value); |
75 | - if (($token->type !== TokenType::Keyword) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
75 | + if (($token->type !== TokenType::Keyword) || (!($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
76 | 76 | $parser->error('Unrecognized data type.', $token); |
77 | 77 | } |
78 | 78 |