@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | public function build(): string |
49 | 49 | { |
50 | - if (! isset($this->statement)) { |
|
50 | + if (!isset($this->statement)) { |
|
51 | 51 | throw new RuntimeException('No statement inside WITH'); |
52 | 52 | } |
53 | 53 |
@@ -261,7 +261,7 @@ |
||
261 | 261 | public function build(): string |
262 | 262 | { |
263 | 263 | if ($this->dest instanceof Expression) { |
264 | - $columns = ! empty($this->columns) ? '(`' . implode('`, `', $this->columns) . '`)' : ''; |
|
264 | + $columns = !empty($this->columns) ? '(`' . implode('`, `', $this->columns) . '`)' : ''; |
|
265 | 265 | |
266 | 266 | return $this->dest . $columns; |
267 | 267 | } |
@@ -142,7 +142,7 @@ |
||
142 | 142 | public function build(): string |
143 | 143 | { |
144 | 144 | $tmp = ''; |
145 | - if (! empty($this->inOut)) { |
|
145 | + if (!empty($this->inOut)) { |
|
146 | 146 | $tmp .= $this->inOut . ' '; |
147 | 147 | } |
148 | 148 |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | - if (! empty($expr->type)) { |
|
193 | + if (!empty($expr->type)) { |
|
194 | 194 | $ret[] = $expr; |
195 | 195 | } |
196 | 196 | |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | $ret = []; |
213 | 213 | foreach ($component as $c) { |
214 | 214 | $ret[] = array_search($c->type, static::$joins) . ' ' . $c->expr |
215 | - . (! empty($c->on) |
|
215 | + . (!empty($c->on) |
|
216 | 216 | ? ' ON ' . Condition::buildAll($c->on) : '') |
217 | - . (! empty($c->using) |
|
217 | + . (!empty($c->using) |
|
218 | 218 | ? ' USING ' . $c->using->build() : ''); |
219 | 219 | } |
220 | 220 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | if ($lastOption === null) { |
110 | 110 | $upper = strtoupper($token->token); |
111 | - if (! isset($options[$upper])) { |
|
111 | + if (!isset($options[$upper])) { |
|
112 | 112 | // There is no option to be processed. |
113 | 113 | break; |
114 | 114 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | if ($state === 0) { |
148 | - if (! is_array($lastOption)) { |
|
148 | + if (!is_array($lastOption)) { |
|
149 | 149 | // This is a just keyword option without any value. |
150 | 150 | // This is the beginning and the end of it. |
151 | 151 | $ret->options[$lastOptionId] = $token->value; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $ret->options[$lastOptionId]['expr'] .= $token->token; |
223 | 223 | |
224 | 224 | if ( |
225 | - ! (($token->token === '(') && ($brackets === 1) |
|
225 | + !(($token->token === '(') && ($brackets === 1) |
|
226 | 226 | || (($token->token === ')') && ($brackets === 0))) |
227 | 227 | ) { |
228 | 228 | // First pair of brackets is being skipped. |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | |
275 | 275 | $options = []; |
276 | 276 | foreach ($this->options as $option) { |
277 | - if (! is_array($option)) { |
|
277 | + if (!is_array($option)) { |
|
278 | 278 | $options[] = $option; |
279 | 279 | } else { |
280 | 280 | $options[] = $option['name'] |
281 | - . (! empty($option['equals']) ? '=' : ' ') |
|
282 | - . (! empty($option['expr']) ? $option['expr'] : $option['value']); |
|
281 | + . (!empty($option['equals']) ? '=' : ' ') |
|
282 | + . (!empty($option['expr']) ? $option['expr'] : $option['value']); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | { |
300 | 300 | foreach ($this->options as $option) { |
301 | 301 | if (is_array($option)) { |
302 | - if (! strcasecmp($key, $option['name'])) { |
|
302 | + if (!strcasecmp($key, $option['name'])) { |
|
303 | 303 | return $getExpr ? $option['expr'] : $option['value']; |
304 | 304 | } |
305 | - } elseif (! strcasecmp($key, $option)) { |
|
305 | + } elseif (!strcasecmp($key, $option)) { |
|
306 | 306 | return true; |
307 | 307 | } |
308 | 308 | } |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | { |
322 | 322 | foreach ($this->options as $idx => $option) { |
323 | 323 | if (is_array($option)) { |
324 | - if (! strcasecmp($key, $option['name'])) { |
|
324 | + if (!strcasecmp($key, $option['name'])) { |
|
325 | 325 | unset($this->options[$idx]); |
326 | 326 | |
327 | 327 | return true; |
328 | 328 | } |
329 | - } elseif (! strcasecmp($key, $option)) { |
|
329 | + } elseif (!strcasecmp($key, $option)) { |
|
330 | 330 | unset($this->options[$idx]); |
331 | 331 | |
332 | 332 | return true; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @throws ParserException |
158 | 158 | */ |
159 | - public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null |
|
159 | + public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null |
|
160 | 160 | { |
161 | 161 | $ret = new static(); |
162 | 162 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | ]; |
200 | 200 | |
201 | 201 | // When a field is parsed, no parentheses are expected. |
202 | - if (! empty($options['parseField'])) { |
|
202 | + if (!empty($options['parseField'])) { |
|
203 | 203 | $options['breakOnParentheses'] = true; |
204 | 204 | $options['field'] = $options['parseField']; |
205 | 205 | } |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | if ($token->type === Token::TYPE_KEYWORD) { |
229 | - if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::$statementParsers[$token->keyword])) { |
|
229 | + if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::$statementParsers[$token->keyword])) { |
|
230 | 230 | // A `(` was previously found and this keyword is the |
231 | 231 | // beginning of a statement, so this is a subquery. |
232 | 232 | $ret->subquery = $token->keyword; |
233 | 233 | } elseif ( |
234 | 234 | ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
235 | 235 | && (empty($options['parseField']) |
236 | - && ! $alias) |
|
236 | + && !$alias) |
|
237 | 237 | ) { |
238 | 238 | $isExpr = true; |
239 | 239 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | if ($token->keyword === 'AS') { |
248 | - if (! empty($options['breakOnAlias'])) { |
|
248 | + if (!empty($options['breakOnAlias'])) { |
|
249 | 249 | break; |
250 | 250 | } |
251 | 251 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | $isExpr = true; |
271 | - } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) { |
|
271 | + } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) { |
|
272 | 272 | /* End of expression */ |
273 | 273 | break; |
274 | 274 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | || (($token->type === Token::TYPE_OPERATOR) |
285 | 285 | && ($token->value !== '.')) |
286 | 286 | ) { |
287 | - if (! empty($options['parseField'])) { |
|
287 | + if (!empty($options['parseField'])) { |
|
288 | 288 | break; |
289 | 289 | } |
290 | 290 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | |
296 | 296 | if ($token->type === Token::TYPE_OPERATOR) { |
297 | - if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
297 | + if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
298 | 298 | // No brackets were expected. |
299 | 299 | break; |
300 | 300 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | |
319 | 319 | --$brackets; |
320 | 320 | if ($brackets === 0) { |
321 | - if (! empty($options['parenthesesDelimited'])) { |
|
321 | + if (!empty($options['parenthesesDelimited'])) { |
|
322 | 322 | // The current token is the last bracket, the next |
323 | 323 | // one will be outside the expression. |
324 | 324 | $ret->expr .= $token->token; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | |
345 | 345 | if ($alias) { |
346 | 346 | // An alias is expected (the keyword `AS` was previously found). |
347 | - if (! empty($ret->alias)) { |
|
347 | + if (!empty($ret->alias)) { |
|
348 | 348 | $parser->error('An alias was previously found.', $token); |
349 | 349 | break; |
350 | 350 | } |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | && ($prev[0] === null |
359 | 359 | || (($prev[0]->type !== Token::TYPE_OPERATOR || $prev[0]->token === ')') |
360 | 360 | && ($prev[0]->type !== Token::TYPE_KEYWORD |
361 | - || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
361 | + || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
362 | 362 | && (($prev[1]->type === Token::TYPE_STRING) |
363 | 363 | || ($prev[1]->type === Token::TYPE_SYMBOL |
364 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
364 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
365 | 365 | || ($prev[1]->type === Token::TYPE_NONE |
366 | 366 | && $prev[1]->token !== 'OVER')) |
367 | 367 | ) { |
368 | - if (! empty($ret->alias)) { |
|
368 | + if (!empty($ret->alias)) { |
|
369 | 369 | $parser->error('An alias was previously found.', $token); |
370 | 370 | break; |
371 | 371 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | // Found a `.` which means we expect a column name and |
397 | 397 | // the column name we parsed is actually the table name |
398 | 398 | // and the table name is actually a database name. |
399 | - if (! empty($ret->database) || $dot) { |
|
399 | + if (!empty($ret->database) || $dot) { |
|
400 | 400 | $parser->error('Unexpected dot.', $token); |
401 | 401 | } |
402 | 402 | |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | $dot = false; |
414 | 414 | } else { |
415 | 415 | // No alias is expected. |
416 | - if (! empty($options['breakOnAlias'])) { |
|
416 | + if (!empty($options['breakOnAlias'])) { |
|
417 | 417 | break; |
418 | 418 | } |
419 | 419 | |
420 | - if (! empty($ret->alias)) { |
|
420 | + if (!empty($ret->alias)) { |
|
421 | 421 | $parser->error('An alias was previously found.', $token); |
422 | 422 | break; |
423 | 423 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | $ret = implode('.', Context::escapeAll($fields)); |
466 | 466 | } |
467 | 467 | |
468 | - if (! empty($this->alias)) { |
|
468 | + if (!empty($this->alias)) { |
|
469 | 469 | $ret .= ' AS ' . Context::escape($this->alias); |
470 | 470 | } |
471 | 471 |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | } elseif ($state === 1) { |
180 | 180 | if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
181 | 181 | $positionBeforeSearch = $list->idx; |
182 | - $list->idx++;// Ignore the current token "(" or the search condition will always be true |
|
182 | + $list->idx++; // Ignore the current token "(" or the search condition will always be true |
|
183 | 183 | $nextToken = $list->getNext(); |
184 | - $list->idx = $positionBeforeSearch;// Restore the position |
|
184 | + $list->idx = $positionBeforeSearch; // Restore the position |
|
185 | 185 | |
186 | 186 | if ($nextToken !== null && $nextToken->value === '(') { |
187 | 187 | // Switch to expression mode |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | if ($token->type === Token::TYPE_OPERATOR) { |
231 | 231 | // This got back to here and we reached the end of the expression |
232 | 232 | if ($token->value === ')') { |
233 | - $state = 4;// go back to state 4 to fetch options |
|
233 | + $state = 4; // go back to state 4 to fetch options |
|
234 | 234 | continue; |
235 | 235 | } |
236 | 236 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | public function build(): string |
267 | 267 | { |
268 | 268 | $ret = $this->type . ' '; |
269 | - if (! empty($this->name)) { |
|
269 | + if (!empty($this->name)) { |
|
270 | 270 | $ret .= Context::escape($this->name) . ' '; |
271 | 271 | } |
272 | 272 |
@@ -233,7 +233,7 @@ |
||
233 | 233 | return trim( |
234 | 234 | 'PARTITION ' . $this->name |
235 | 235 | . (empty($this->type) ? '' : ' VALUES ' . $this->type . ' ' . $this->expr . ' ') |
236 | - . (! empty($this->options) && ! empty($this->type) ? '' : ' ') |
|
236 | + . (!empty($this->options) && !empty($this->type) ? '' : ' ') |
|
237 | 237 | . $this->options . $subpartitions |
238 | 238 | ); |
239 | 239 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $state = 4; |
243 | 243 | } elseif ($token->type === Token::TYPE_SYMBOL || $token->type === Token::TYPE_NONE) { |
244 | 244 | $expr->name = $token->value; |
245 | - if (! $expr->isConstraint) { |
|
245 | + if (!$expr->isConstraint) { |
|
246 | 246 | $state = 2; |
247 | 247 | } |
248 | 248 | } elseif ($token->type === Token::TYPE_KEYWORD) { |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | $state = 5; |
285 | 285 | } elseif ($state === 5) { |
286 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
286 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
287 | 287 | $ret[] = $expr; |
288 | 288 | } |
289 | 289 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | |
305 | 305 | // Last iteration was not saved. |
306 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
306 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
307 | 307 | $ret[] = $expr; |
308 | 308 | } |
309 | 309 | |
@@ -328,16 +328,16 @@ discard block |
||
328 | 328 | $tmp .= Context::escape($this->name) . ' '; |
329 | 329 | } |
330 | 330 | |
331 | - if (! empty($this->type)) { |
|
331 | + if (!empty($this->type)) { |
|
332 | 332 | $this->type->lowercase = true; |
333 | 333 | $tmp .= $this->type->build() . ' '; |
334 | 334 | } |
335 | 335 | |
336 | - if (! empty($this->key)) { |
|
336 | + if (!empty($this->key)) { |
|
337 | 337 | $tmp .= $this->key . ' '; |
338 | 338 | } |
339 | 339 | |
340 | - if (! empty($this->references)) { |
|
340 | + if (!empty($this->references)) { |
|
341 | 341 | $tmp .= 'REFERENCES ' . $this->references . ' '; |
342 | 342 | } |
343 | 343 |