@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $state = 4; |
| 244 | 244 | } elseif ($token->type === Token::TYPE_SYMBOL || $token->type === Token::TYPE_NONE) { |
| 245 | 245 | $expr->name = $token->value; |
| 246 | - if (! $expr->isConstraint) { |
|
| 246 | + if (!$expr->isConstraint) { |
|
| 247 | 247 | $state = 2; |
| 248 | 248 | } |
| 249 | 249 | } elseif ($token->type === Token::TYPE_KEYWORD) { |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $state = 5; |
| 286 | 286 | } elseif ($state === 5) { |
| 287 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
| 287 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
| 288 | 288 | $ret[] = $expr; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | // Last iteration was not saved. |
| 307 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
| 307 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
| 308 | 308 | $ret[] = $expr; |
| 309 | 309 | } |
| 310 | 310 | |
@@ -336,16 +336,16 @@ discard block |
||
| 336 | 336 | $tmp .= Context::escape($component->name) . ' '; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - if (! empty($component->type)) { |
|
| 339 | + if (!empty($component->type)) { |
|
| 340 | 340 | $component->type->lowercase = true; |
| 341 | 341 | $tmp .= DataType::build($component->type) . ' '; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if (! empty($component->key)) { |
|
| 344 | + if (!empty($component->key)) { |
|
| 345 | 345 | $tmp .= $component->key . ' '; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - if (! empty($component->references)) { |
|
| 348 | + if (!empty($component->references)) { |
|
| 349 | 349 | $tmp .= 'REFERENCES ' . $component->references . ' '; |
| 350 | 350 | } |
| 351 | 351 | |
@@ -264,7 +264,7 @@ |
||
| 264 | 264 | public static function build($component): string |
| 265 | 265 | { |
| 266 | 266 | if ($component->dest instanceof Expression) { |
| 267 | - $columns = ! empty($component->columns) ? '(`' . implode('`, `', $component->columns) . '`)' : ''; |
|
| 267 | + $columns = !empty($component->columns) ? '(`' . implode('`, `', $component->columns) . '`)' : ''; |
|
| 268 | 268 | |
| 269 | 269 | return $component->dest . $columns; |
| 270 | 270 | } |
@@ -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 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | public static function build($component): string |
| 270 | 270 | { |
| 271 | 271 | $ret = $component->type . ' '; |
| 272 | - if (! empty($component->name)) { |
|
| 272 | + if (!empty($component->name)) { |
|
| 273 | 273 | $ret .= Context::escape($component->name) . ' '; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -145,7 +145,7 @@ |
||
| 145 | 145 | public static function build($component): string |
| 146 | 146 | { |
| 147 | 147 | $tmp = ''; |
| 148 | - if (! empty($component->inOut)) { |
|
| 148 | + if (!empty($component->inOut)) { |
|
| 149 | 149 | $tmp .= $component->inOut . ' '; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -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 ' . ArrayObj::build($c->using) : ''); |
| 219 | 219 | } |
| 220 | 220 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public static function build($component): string |
| 52 | 52 | { |
| 53 | - if (! isset($component->statement)) { |
|
| 53 | + if (!isset($component->statement)) { |
|
| 54 | 54 | throw new RuntimeException('No statement inside WITH'); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @var ArrayObj[]|null |
| 65 | 65 | */ |
| 66 | - public array|null $values = null; |
|
| 66 | + public array | null $values = null; |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * If SET clause is present |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @var SetOperation[]|null |
| 73 | 73 | */ |
| 74 | - public array|null $set = null; |
|
| 74 | + public array | null $set = null; |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * If SELECT clause is present |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | } elseif (($token->value === ',') && ($brackets === 0)) { |
| 425 | 425 | break; |
| 426 | 426 | } |
| 427 | - } elseif (! self::checkIfTokenQuotedSymbol($token)) { |
|
| 427 | + } elseif (!self::checkIfTokenQuotedSymbol($token)) { |
|
| 428 | 428 | // If the current token is "SET" or "ENUM", we want to avoid the token between their parenthesis in |
| 429 | 429 | // the unknown tokens. |
| 430 | 430 | if (in_array($token->value, ['SET', 'ENUM'], true)) { |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | ); |
| 444 | 444 | break; |
| 445 | 445 | } |
| 446 | - } elseif (! empty(Parser::$statementParsers[$token->value])) { |
|
| 446 | + } elseif (!empty(Parser::$statementParsers[$token->value])) { |
|
| 447 | 447 | // We have reached the end of ALTER operation and suddenly found |
| 448 | 448 | // a start to new statement, but have not found a delimiter between them |
| 449 | 449 | $parser->error( |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | } elseif ( |
| 455 | 455 | (array_key_exists($arrayKey, self::$databaseOptions) |
| 456 | 456 | || array_key_exists($arrayKey, self::$tableOptions)) |
| 457 | - && ! self::checkIfColumnDefinitionKeyword($arrayKey) |
|
| 457 | + && !self::checkIfColumnDefinitionKeyword($arrayKey) |
|
| 458 | 458 | ) { |
| 459 | 459 | // This alter operation has finished, which means a comma |
| 460 | 460 | // was missing before start of new alter operation |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @throws ParserException |
| 159 | 159 | */ |
| 160 | - public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null |
|
| 160 | + public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null |
|
| 161 | 161 | { |
| 162 | 162 | $ret = new static(); |
| 163 | 163 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | ]; |
| 201 | 201 | |
| 202 | 202 | // When a field is parsed, no parentheses are expected. |
| 203 | - if (! empty($options['parseField'])) { |
|
| 203 | + if (!empty($options['parseField'])) { |
|
| 204 | 204 | $options['breakOnParentheses'] = true; |
| 205 | 205 | $options['field'] = $options['parseField']; |
| 206 | 206 | } |
@@ -227,14 +227,14 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if ($token->type === Token::TYPE_KEYWORD) { |
| 230 | - if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::$statementParsers[$token->keyword])) { |
|
| 230 | + if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::$statementParsers[$token->keyword])) { |
|
| 231 | 231 | // A `(` was previously found and this keyword is the |
| 232 | 232 | // beginning of a statement, so this is a subquery. |
| 233 | 233 | $ret->subquery = $token->keyword; |
| 234 | 234 | } elseif ( |
| 235 | 235 | ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
| 236 | 236 | && (empty($options['parseField']) |
| 237 | - && ! $alias) |
|
| 237 | + && !$alias) |
|
| 238 | 238 | ) { |
| 239 | 239 | $isExpr = true; |
| 240 | 240 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) { |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | if ($token->keyword === 'AS') { |
| 249 | - if (! empty($options['breakOnAlias'])) { |
|
| 249 | + if (!empty($options['breakOnAlias'])) { |
|
| 250 | 250 | break; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | $isExpr = true; |
| 272 | - } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) { |
|
| 272 | + } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) { |
|
| 273 | 273 | /* End of expression */ |
| 274 | 274 | break; |
| 275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | || (($token->type === Token::TYPE_OPERATOR) |
| 286 | 286 | && ($token->value !== '.')) |
| 287 | 287 | ) { |
| 288 | - if (! empty($options['parseField'])) { |
|
| 288 | + if (!empty($options['parseField'])) { |
|
| 289 | 289 | break; |
| 290 | 290 | } |
| 291 | 291 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | if ($token->type === Token::TYPE_OPERATOR) { |
| 298 | - if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
| 298 | + if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
| 299 | 299 | // No brackets were expected. |
| 300 | 300 | break; |
| 301 | 301 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | --$brackets; |
| 321 | 321 | if ($brackets === 0) { |
| 322 | - if (! empty($options['parenthesesDelimited'])) { |
|
| 322 | + if (!empty($options['parenthesesDelimited'])) { |
|
| 323 | 323 | // The current token is the last bracket, the next |
| 324 | 324 | // one will be outside the expression. |
| 325 | 325 | $ret->expr .= $token->token; |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | if ($alias) { |
| 347 | 347 | // An alias is expected (the keyword `AS` was previously found). |
| 348 | - if (! empty($ret->alias)) { |
|
| 348 | + if (!empty($ret->alias)) { |
|
| 349 | 349 | $parser->error('An alias was previously found.', $token); |
| 350 | 350 | break; |
| 351 | 351 | } |
@@ -359,14 +359,14 @@ discard block |
||
| 359 | 359 | && ($prev[0] === null |
| 360 | 360 | || (($prev[0]->type !== Token::TYPE_OPERATOR || $prev[0]->token === ')') |
| 361 | 361 | && ($prev[0]->type !== Token::TYPE_KEYWORD |
| 362 | - || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
| 362 | + || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
| 363 | 363 | && (($prev[1]->type === Token::TYPE_STRING) |
| 364 | 364 | || ($prev[1]->type === Token::TYPE_SYMBOL |
| 365 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
| 365 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
| 366 | 366 | || ($prev[1]->type === Token::TYPE_NONE |
| 367 | 367 | && $prev[1]->token !== 'OVER')) |
| 368 | 368 | ) { |
| 369 | - if (! empty($ret->alias)) { |
|
| 369 | + if (!empty($ret->alias)) { |
|
| 370 | 370 | $parser->error('An alias was previously found.', $token); |
| 371 | 371 | break; |
| 372 | 372 | } |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | // Found a `.` which means we expect a column name and |
| 398 | 398 | // the column name we parsed is actually the table name |
| 399 | 399 | // and the table name is actually a database name. |
| 400 | - if (! empty($ret->database) || $dot) { |
|
| 400 | + if (!empty($ret->database) || $dot) { |
|
| 401 | 401 | $parser->error('Unexpected dot.', $token); |
| 402 | 402 | } |
| 403 | 403 | |
@@ -414,11 +414,11 @@ discard block |
||
| 414 | 414 | $dot = false; |
| 415 | 415 | } else { |
| 416 | 416 | // No alias is expected. |
| 417 | - if (! empty($options['breakOnAlias'])) { |
|
| 417 | + if (!empty($options['breakOnAlias'])) { |
|
| 418 | 418 | break; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - if (! empty($ret->alias)) { |
|
| 421 | + if (!empty($ret->alias)) { |
|
| 422 | 422 | $parser->error('An alias was previously found.', $token); |
| 423 | 423 | break; |
| 424 | 424 | } |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | $ret = implode('.', Context::escapeAll($fields)); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - if (! empty($component->alias)) { |
|
| 476 | + if (!empty($component->alias)) { |
|
| 477 | 477 | $ret .= ' AS ' . Context::escape($component->alias); |
| 478 | 478 | } |
| 479 | 479 | |