@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | * @param Reference|null $references references |
67 | 67 | */ |
68 | 68 | public function __construct( |
69 | - string|null $name = null, |
|
70 | - OptionsArray|null $options = null, |
|
71 | - DataType|Key|null $type = null, |
|
69 | + string | null $name = null, |
|
70 | + OptionsArray | null $options = null, |
|
71 | + DataType | Key | null $type = null, |
|
72 | 72 | bool $isConstraint = false, |
73 | - Reference|null $references = null, |
|
73 | + Reference | null $references = null, |
|
74 | 74 | ) { |
75 | 75 | $this->name = $name; |
76 | 76 | $this->options = $options; |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | $tmp .= Context::escape($this->name) . ' '; |
96 | 96 | } |
97 | 97 | |
98 | - if (! empty($this->type)) { |
|
98 | + if (!empty($this->type)) { |
|
99 | 99 | $this->type->lowercase = true; |
100 | 100 | $tmp .= $this->type->build() . ' '; |
101 | 101 | } |
102 | 102 | |
103 | - if (! empty($this->key)) { |
|
103 | + if (!empty($this->key)) { |
|
104 | 104 | $tmp .= $this->key . ' '; |
105 | 105 | } |
106 | 106 | |
107 | - if (! empty($this->references)) { |
|
107 | + if (!empty($this->references)) { |
|
108 | 108 | $tmp .= 'REFERENCES ' . $this->references . ' '; |
109 | 109 | } |
110 | 110 |
@@ -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 | } |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | * @param string|null $alias the name of the alias |
114 | 114 | */ |
115 | 115 | public function __construct( |
116 | - string|null $database = null, |
|
117 | - string|null $table = null, |
|
118 | - string|null $column = null, |
|
119 | - string|null $alias = null, |
|
116 | + string | null $database = null, |
|
117 | + string | null $table = null, |
|
118 | + string | null $column = null, |
|
119 | + string | null $alias = null, |
|
120 | 120 | ) { |
121 | 121 | if (($column === null) && ($alias === null)) { |
122 | 122 | $this->expr = $database; // case 1 |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @throws ParserException |
163 | 163 | */ |
164 | - public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null |
|
164 | + public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null |
|
165 | 165 | { |
166 | 166 | $ret = new static(); |
167 | 167 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | ]; |
195 | 195 | |
196 | 196 | // When a field is parsed, no parentheses are expected. |
197 | - if (! empty($options['parseField'])) { |
|
197 | + if (!empty($options['parseField'])) { |
|
198 | 198 | $options['breakOnParentheses'] = true; |
199 | 199 | $options['field'] = $options['parseField']; |
200 | 200 | } |
@@ -221,18 +221,18 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | if ($token->type === TokenType::Keyword) { |
224 | - if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
224 | + if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
225 | 225 | // A `(` was previously found and this keyword is the |
226 | 226 | // beginning of a statement, so this is a subquery. |
227 | 227 | $ret->subquery = $token->keyword; |
228 | 228 | } elseif ( |
229 | 229 | ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
230 | 230 | && (empty($options['parseField']) |
231 | - && ! $alias) |
|
231 | + && !$alias) |
|
232 | 232 | ) { |
233 | 233 | $isExpr = true; |
234 | 234 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) { |
235 | - if (! in_array($token->keyword, self::ALLOWED_KEYWORDS, true)) { |
|
235 | + if (!in_array($token->keyword, self::ALLOWED_KEYWORDS, true)) { |
|
236 | 236 | // A reserved keyword that is not allowed in the |
237 | 237 | // expression was found so the expression must have |
238 | 238 | // ended and a new clause is starting. |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | if ($token->keyword === 'AS') { |
243 | - if (! empty($options['breakOnAlias'])) { |
|
243 | + if (!empty($options['breakOnAlias'])) { |
|
244 | 244 | break; |
245 | 245 | } |
246 | 246 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | $isExpr = true; |
266 | - } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) { |
|
266 | + } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) { |
|
267 | 267 | /* End of expression */ |
268 | 268 | break; |
269 | 269 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | || (($token->type === TokenType::Operator) |
280 | 280 | && ($token->value !== '.')) |
281 | 281 | ) { |
282 | - if (! empty($options['parseField'])) { |
|
282 | + if (!empty($options['parseField'])) { |
|
283 | 283 | break; |
284 | 284 | } |
285 | 285 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | if ($token->type === TokenType::Operator) { |
292 | - if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
292 | + if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
293 | 293 | // No brackets were expected. |
294 | 294 | break; |
295 | 295 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | --$brackets; |
315 | 315 | if ($brackets === 0) { |
316 | - if (! empty($options['parenthesesDelimited'])) { |
|
316 | + if (!empty($options['parenthesesDelimited'])) { |
|
317 | 317 | // The current token is the last bracket, the next |
318 | 318 | // one will be outside the expression. |
319 | 319 | $ret->expr .= $token->token; |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | |
340 | 340 | if ($alias) { |
341 | 341 | // An alias is expected (the keyword `AS` was previously found). |
342 | - if (! empty($ret->alias)) { |
|
342 | + if (!empty($ret->alias)) { |
|
343 | 343 | $parser->error('An alias was previously found.', $token); |
344 | 344 | break; |
345 | 345 | } |
@@ -353,15 +353,15 @@ discard block |
||
353 | 353 | && ($prev[0] === null |
354 | 354 | || (($prev[0]->type !== TokenType::Operator || $prev[0]->token === ')') |
355 | 355 | && ($prev[0]->type !== TokenType::Keyword |
356 | - || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
356 | + || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
357 | 357 | && (($prev[1]->type === TokenType::String) |
358 | 358 | || ($prev[1]->type === TokenType::Symbol |
359 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
360 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER)) |
|
359 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
360 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER)) |
|
361 | 361 | || ($prev[1]->type === TokenType::None |
362 | 362 | && $prev[1]->token !== 'OVER')) |
363 | 363 | ) { |
364 | - if (! empty($ret->alias)) { |
|
364 | + if (!empty($ret->alias)) { |
|
365 | 365 | $parser->error('An alias was previously found.', $token); |
366 | 366 | break; |
367 | 367 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | // Found a `.` which means we expect a column name and |
393 | 393 | // the column name we parsed is actually the table name |
394 | 394 | // and the table name is actually a database name. |
395 | - if (! empty($ret->database) || $dot) { |
|
395 | + if (!empty($ret->database) || $dot) { |
|
396 | 396 | $parser->error('Unexpected dot.', $token); |
397 | 397 | } |
398 | 398 | |
@@ -409,11 +409,11 @@ discard block |
||
409 | 409 | $dot = false; |
410 | 410 | } else { |
411 | 411 | // No alias is expected. |
412 | - if (! empty($options['breakOnAlias'])) { |
|
412 | + if (!empty($options['breakOnAlias'])) { |
|
413 | 413 | break; |
414 | 414 | } |
415 | 415 | |
416 | - if (! empty($ret->alias)) { |
|
416 | + if (!empty($ret->alias)) { |
|
417 | 417 | $parser->error('An alias was previously found.', $token); |
418 | 418 | break; |
419 | 419 | } |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $ret = implode('.', Context::escapeAll($fields)); |
462 | 462 | } |
463 | 463 | |
464 | - if (! empty($this->alias)) { |
|
464 | + if (!empty($this->alias)) { |
|
465 | 465 | $ret .= ' AS ' . Context::escape($this->alias); |
466 | 466 | } |
467 | 467 |
@@ -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 |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } else { |
116 | 116 | // The expression ended. |
117 | 117 | $expr->expr = trim($expr->expr); |
118 | - if (! empty($expr->expr)) { |
|
118 | + if (!empty($expr->expr)) { |
|
119 | 119 | $ret[] = $expr; |
120 | 120 | } |
121 | 121 | |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | if ( |
134 | 134 | ($token->type === TokenType::Keyword) |
135 | 135 | && ($token->flags & Token::FLAG_KEYWORD_RESERVED) |
136 | - && ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
136 | + && !($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
137 | 137 | ) { |
138 | 138 | if ($token->value === 'BETWEEN') { |
139 | 139 | $betweenBefore = true; |
140 | 140 | } |
141 | 141 | |
142 | - if ($brackets === 0 && ! in_array($token->value, self::ALLOWED_KEYWORDS, true)) { |
|
142 | + if ($brackets === 0 && !in_array($token->value, self::ALLOWED_KEYWORDS, true)) { |
|
143 | 143 | break; |
144 | 144 | } |
145 | 145 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | // Last iteration was not processed. |
178 | 178 | $expr->expr = trim($expr->expr); |
179 | - if (! empty($expr->expr)) { |
|
179 | + if (!empty($expr->expr)) { |
|
180 | 180 | $ret[] = $expr; |
181 | 181 | } |
182 | 182 |