@@ -66,23 +66,23 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @see Statement::$statementOptions |
68 | 68 | */ |
69 | - public OptionsArray|null $options = null; |
|
69 | + public OptionsArray | null $options = null; |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * The index of the first token used in this statement. |
73 | 73 | */ |
74 | - public int|null $first = null; |
|
74 | + public int | null $first = null; |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * The index of the last token used in this statement. |
78 | 78 | */ |
79 | - public int|null $last = null; |
|
79 | + public int | null $last = null; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @param Parser|null $parser the instance that requests parsing |
83 | 83 | * @param TokensList|null $list the list of tokens to be parsed |
84 | 84 | */ |
85 | - public function __construct(Parser|null $parser = null, TokensList|null $list = null) |
|
85 | + public function __construct(Parser | null $parser = null, TokensList | null $list = null) |
|
86 | 86 | { |
87 | 87 | if (($parser === null) || ($list === null)) { |
88 | 88 | return; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | // Checking if this field was already built. |
129 | 129 | if ($type & self::ADD_CLAUSE) { |
130 | - if (! empty($built[$field])) { |
|
130 | + if (!empty($built[$field])) { |
|
131 | 131 | continue; |
132 | 132 | } |
133 | 133 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | // Checking if the result of the builder should be added. |
143 | - if (! ($type & self::ADD_CLAUSE)) { |
|
143 | + if (!($type & self::ADD_CLAUSE)) { |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | $options = []; |
242 | 242 | |
243 | 243 | // Looking for duplicated clauses. |
244 | - if (isset(Parser::KEYWORD_PARSERS[$token->value]) || ! empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
245 | - if (! empty($parsedClauses[$token->value])) { |
|
244 | + if (isset(Parser::KEYWORD_PARSERS[$token->value]) || !empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
245 | + if (!empty($parsedClauses[$token->value])) { |
|
246 | 246 | $parser->error('This type of clause was previously parsed.', $token); |
247 | 247 | break; |
248 | 248 | } |
@@ -258,15 +258,15 @@ discard block |
||
258 | 258 | if (isset(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) { |
259 | 259 | $class = Parser::KEYWORD_PARSERS[$tokenValue]['class']; |
260 | 260 | $field = Parser::KEYWORD_PARSERS[$tokenValue]['field']; |
261 | - if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
261 | + if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
262 | 262 | $options = Parser::KEYWORD_PARSERS[$tokenValue]['options']; |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | 266 | // Checking if this is the beginning of the statement. |
267 | - if (! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
267 | + if (!empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
268 | 268 | if ( |
269 | - ! empty(static::$clauses) // Undefined for some statements. |
|
269 | + !empty(static::$clauses) // Undefined for some statements. |
|
270 | 270 | && empty(static::$clauses[$token->value]) |
271 | 271 | ) { |
272 | 272 | // Some keywords (e.g. `SET`) may be the beginning of a |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | break; |
282 | 282 | } |
283 | 283 | |
284 | - if (! $parsedOptions) { |
|
285 | - if (! array_key_exists((string) $token->value, static::$statementOptions)) { |
|
284 | + if (!$parsedOptions) { |
|
285 | + if (!array_key_exists((string) $token->value, static::$statementOptions)) { |
|
286 | 286 | // Skipping keyword because if it is not a option. |
287 | 287 | ++$list->idx; |
288 | 288 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $parsedOptions = true; |
292 | 292 | } |
293 | 293 | } elseif ($class === null) { |
294 | - if (! ($this instanceof SetStatement) || ($token->value !== 'COLLATE' && $token->value !== 'DEFAULT')) { |
|
294 | + if (!($this instanceof SetStatement) || ($token->value !== 'COLLATE' && $token->value !== 'DEFAULT')) { |
|
295 | 295 | // There is no parser for this keyword and isn't the beginning |
296 | 296 | // of a statement (so no options) either. |
297 | 297 | $parser->error('Unrecognized keyword.', $token); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | if ($minJoin === 0 && stripos($clauseType, 'JOIN')) { |
424 | 424 | // First JOIN clause is detected |
425 | 425 | $minJoin = $maxJoin = $clauseStartIdx; |
426 | - } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) { |
|
426 | + } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) { |
|
427 | 427 | // After a previous JOIN clause, a non-JOIN clause has been detected |
428 | 428 | $maxJoin = $lastIdx; |
429 | 429 | } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) { |
@@ -249,67 +249,67 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @var IndexHint[]|null |
251 | 251 | */ |
252 | - public array|null $indexHints = null; |
|
252 | + public array | null $indexHints = null; |
|
253 | 253 | |
254 | 254 | /** |
255 | 255 | * Partitions used as source for this statement. |
256 | 256 | */ |
257 | - public ArrayObj|null $partition = null; |
|
257 | + public ArrayObj | null $partition = null; |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Conditions used for filtering each row of the result set. |
261 | 261 | * |
262 | 262 | * @var Condition[]|null |
263 | 263 | */ |
264 | - public array|null $where = null; |
|
264 | + public array | null $where = null; |
|
265 | 265 | |
266 | 266 | /** |
267 | 267 | * Conditions used for grouping the result set. |
268 | 268 | * |
269 | 269 | * @var GroupKeyword[]|null |
270 | 270 | */ |
271 | - public array|null $group = null; |
|
271 | + public array | null $group = null; |
|
272 | 272 | |
273 | 273 | /** |
274 | 274 | * List of options available for the GROUP BY component. |
275 | 275 | */ |
276 | - public OptionsArray|null $groupOptions = null; |
|
276 | + public OptionsArray | null $groupOptions = null; |
|
277 | 277 | |
278 | 278 | /** |
279 | 279 | * Conditions used for filtering the result set. |
280 | 280 | * |
281 | 281 | * @var Condition[]|null |
282 | 282 | */ |
283 | - public array|null $having = null; |
|
283 | + public array | null $having = null; |
|
284 | 284 | |
285 | 285 | /** |
286 | 286 | * Specifies the order of the rows in the result set. |
287 | 287 | * |
288 | 288 | * @var OrderKeyword[]|null |
289 | 289 | */ |
290 | - public array|null $order = null; |
|
290 | + public array | null $order = null; |
|
291 | 291 | |
292 | 292 | /** |
293 | 293 | * Conditions used for limiting the size of the result set. |
294 | 294 | */ |
295 | - public Limit|null $limit = null; |
|
295 | + public Limit | null $limit = null; |
|
296 | 296 | |
297 | 297 | /** |
298 | 298 | * Procedure that should process the data in the result set. |
299 | 299 | */ |
300 | - public FunctionCall|null $procedure = null; |
|
300 | + public FunctionCall | null $procedure = null; |
|
301 | 301 | |
302 | 302 | /** |
303 | 303 | * Destination of this result set. |
304 | 304 | */ |
305 | - public IntoKeyword|null $into = null; |
|
305 | + public IntoKeyword | null $into = null; |
|
306 | 306 | |
307 | 307 | /** |
308 | 308 | * Joins. |
309 | 309 | * |
310 | 310 | * @var JoinKeyword[]|null |
311 | 311 | */ |
312 | - public array|null $join = null; |
|
312 | + public array | null $join = null; |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * Unions. |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @see SelectStatement::STATEMENT_END_OPTIONS |
325 | 325 | */ |
326 | - public OptionsArray|null $endOptions = null; |
|
326 | + public OptionsArray | null $endOptions = null; |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * Parses the statements defined by the tokens list. |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | $options = []; |
434 | 434 | |
435 | 435 | // Looking for duplicated clauses. |
436 | - if (isset(Parser::KEYWORD_PARSERS[$token->value]) || ! empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
437 | - if (! empty($parsedClauses[$token->value])) { |
|
436 | + if (isset(Parser::KEYWORD_PARSERS[$token->value]) || !empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
437 | + if (!empty($parsedClauses[$token->value])) { |
|
438 | 438 | $parser->error('This type of clause was previously parsed.', $token); |
439 | 439 | break; |
440 | 440 | } |
@@ -450,15 +450,15 @@ discard block |
||
450 | 450 | if (isset(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) { |
451 | 451 | $class = Parser::KEYWORD_PARSERS[$tokenValue]['class']; |
452 | 452 | $field = Parser::KEYWORD_PARSERS[$tokenValue]['field']; |
453 | - if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
453 | + if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
454 | 454 | $options = Parser::KEYWORD_PARSERS[$tokenValue]['options']; |
455 | 455 | } |
456 | 456 | } |
457 | 457 | |
458 | 458 | // Checking if this is the beginning of the statement. |
459 | - if (! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
459 | + if (!empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
460 | 460 | if ( |
461 | - ! empty(static::$clauses) // Undefined for some statements. |
|
461 | + !empty(static::$clauses) // Undefined for some statements. |
|
462 | 462 | && empty(static::$clauses[$token->value]) |
463 | 463 | ) { |
464 | 464 | // Some keywords (e.g. `SET`) may be the beginning of a |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | break; |
474 | 474 | } |
475 | 475 | |
476 | - if (! $parsedOptions) { |
|
477 | - if (! array_key_exists((string) $token->value, static::$statementOptions)) { |
|
476 | + if (!$parsedOptions) { |
|
477 | + if (!array_key_exists((string) $token->value, static::$statementOptions)) { |
|
478 | 478 | // Skipping keyword because if it is not a option. |
479 | 479 | ++$list->idx; |
480 | 480 | } |
@@ -569,28 +569,28 @@ discard block |
||
569 | 569 | $expressions = $this->from; |
570 | 570 | |
571 | 571 | // Adding expressions from JOIN. |
572 | - if (! empty($this->join)) { |
|
572 | + if (!empty($this->join)) { |
|
573 | 573 | foreach ($this->join as $join) { |
574 | 574 | $expressions[] = $join->expr; |
575 | 575 | } |
576 | 576 | } |
577 | 577 | |
578 | 578 | foreach ($expressions as $expr) { |
579 | - if (! isset($expr->table) || ($expr->table === '')) { |
|
579 | + if (!isset($expr->table) || ($expr->table === '')) { |
|
580 | 580 | continue; |
581 | 581 | } |
582 | 582 | |
583 | 583 | $thisDb = isset($expr->database) && ($expr->database !== '') ? |
584 | 584 | $expr->database : $database; |
585 | 585 | |
586 | - if (! isset($retval[$thisDb])) { |
|
586 | + if (!isset($retval[$thisDb])) { |
|
587 | 587 | $retval[$thisDb] = [ |
588 | 588 | 'alias' => null, |
589 | 589 | 'tables' => [], |
590 | 590 | ]; |
591 | 591 | } |
592 | 592 | |
593 | - if (! isset($retval[$thisDb]['tables'][$expr->table])) { |
|
593 | + if (!isset($retval[$thisDb]['tables'][$expr->table])) { |
|
594 | 594 | $retval[$thisDb]['tables'][$expr->table] = [ |
595 | 595 | 'alias' => isset($expr->alias) && ($expr->alias !== '') ? |
596 | 596 | $expr->alias : null, |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | ]; |
599 | 599 | } |
600 | 600 | |
601 | - if (! isset($tables[$thisDb])) { |
|
601 | + if (!isset($tables[$thisDb])) { |
|
602 | 602 | $tables[$thisDb] = []; |
603 | 603 | } |
604 | 604 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | } |
607 | 607 | |
608 | 608 | foreach ($this->expr as $expr) { |
609 | - if (! isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '')) { |
|
609 | + if (!isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '')) { |
|
610 | 610 | continue; |
611 | 611 | } |
612 | 612 |