@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | } elseif (($token->value === ',') && ($brackets === 0)) { |
271 | 271 | break; |
272 | 272 | } |
273 | - } elseif (! empty(Parser::$STATEMENT_PARSERS[$token->value])) { |
|
273 | + } elseif (!empty(Parser::$STATEMENT_PARSERS[$token->value])) { |
|
274 | 274 | // We have reached the end of ALTER operation and suddenly found |
275 | 275 | // a start to new statement, but have not find a delimiter between them |
276 | 276 | |
277 | - if (! ($token->value === 'SET' && $list->tokens[$list->idx - 1]->value === 'CHARACTER')) { |
|
277 | + if (!($token->value === 'SET' && $list->tokens[$list->idx - 1]->value === 'CHARACTER')) { |
|
278 | 278 | $parser->error( |
279 | 279 | 'A new statement was found, but no delimiter between it and the previous one.', |
280 | 280 | $token |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | } |
284 | 284 | } elseif ((array_key_exists($token->value, self::$DB_OPTIONS) |
285 | 285 | || array_key_exists($token->value, self::$TABLE_OPTIONS)) |
286 | - && ! self::checkIfColumnDefinitionKeyword($token->value) |
|
286 | + && !self::checkIfColumnDefinitionKeyword($token->value) |
|
287 | 287 | ) { |
288 | 288 | // This alter operation has finished, which means a comma |
289 | 289 | // was missing before start of new alter operation |
@@ -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 | } |
@@ -231,14 +231,14 @@ discard block |
||
231 | 231 | |
232 | 232 | if ($token->type === Token::TYPE_KEYWORD) { |
233 | 233 | if (($brackets > 0) && empty($ret->subquery) |
234 | - && ! empty(Parser::$STATEMENT_PARSERS[$token->keyword]) |
|
234 | + && !empty(Parser::$STATEMENT_PARSERS[$token->keyword]) |
|
235 | 235 | ) { |
236 | 236 | // A `(` was previously found and this keyword is the |
237 | 237 | // beginning of a statement, so this is a subquery. |
238 | 238 | $ret->subquery = $token->keyword; |
239 | 239 | } elseif (($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
240 | 240 | && (empty($options['parseField']) |
241 | - && ! $alias) |
|
241 | + && !$alias) |
|
242 | 242 | ) { |
243 | 243 | $isExpr = true; |
244 | 244 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | if ($token->keyword === 'AS') { |
255 | - if (! empty($options['breakOnAlias'])) { |
|
255 | + if (!empty($options['breakOnAlias'])) { |
|
256 | 256 | break; |
257 | 257 | } |
258 | 258 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | $isExpr = true; |
279 | - } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) { |
|
279 | + } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) { |
|
280 | 280 | /* End of expression */ |
281 | 281 | break; |
282 | 282 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | || (($token->type === Token::TYPE_OPERATOR) |
292 | 292 | && ($token->value !== '.')) |
293 | 293 | ) { |
294 | - if (! empty($options['parseField'])) { |
|
294 | + if (!empty($options['parseField'])) { |
|
295 | 295 | break; |
296 | 296 | } |
297 | 297 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | } |
302 | 302 | |
303 | 303 | if ($token->type === Token::TYPE_OPERATOR) { |
304 | - if (! empty($options['breakOnParentheses']) |
|
304 | + if (!empty($options['breakOnParentheses']) |
|
305 | 305 | && (($token->value === '(') || ($token->value === ')')) |
306 | 306 | ) { |
307 | 307 | // No brackets were expected. |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } else { |
326 | 326 | --$brackets; |
327 | 327 | if ($brackets === 0) { |
328 | - if (! empty($options['parenthesesDelimited'])) { |
|
328 | + if (!empty($options['parenthesesDelimited'])) { |
|
329 | 329 | // The current token is the last bracket, the next |
330 | 330 | // one will be outside the expression. |
331 | 331 | $ret->expr .= $token->token; |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | if ($alias) { |
354 | 354 | // An alias is expected (the keyword `AS` was previously found). |
355 | - if (! empty($ret->alias)) { |
|
355 | + if (!empty($ret->alias)) { |
|
356 | 356 | $parser->error('An alias was previously found.', $token); |
357 | 357 | break; |
358 | 358 | } |
@@ -365,13 +365,13 @@ discard block |
||
365 | 365 | && ($prev[0] === null |
366 | 366 | || (($prev[0]->type !== Token::TYPE_OPERATOR || $prev[0]->token === ')') |
367 | 367 | && ($prev[0]->type !== Token::TYPE_KEYWORD |
368 | - || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
368 | + || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
369 | 369 | && (($prev[1]->type === Token::TYPE_STRING) |
370 | 370 | || ($prev[1]->type === Token::TYPE_SYMBOL |
371 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
371 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)) |
|
372 | 372 | || ($prev[1]->type === Token::TYPE_NONE)) |
373 | 373 | ) { |
374 | - if (! empty($ret->alias)) { |
|
374 | + if (!empty($ret->alias)) { |
|
375 | 375 | $parser->error('An alias was previously found.', $token); |
376 | 376 | break; |
377 | 377 | } |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | } else { |
381 | 381 | $ret->expr .= $token->token; |
382 | 382 | } |
383 | - } elseif (! $isExpr) { |
|
383 | + } elseif (!$isExpr) { |
|
384 | 384 | if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '.')) { |
385 | 385 | // Found a `.` which means we expect a column name and |
386 | 386 | // the column name we parsed is actually the table name |
387 | 387 | // and the table name is actually a database name. |
388 | - if (! empty($ret->database) || $dot) { |
|
388 | + if (!empty($ret->database) || $dot) { |
|
389 | 389 | $parser->error('Unexpected dot.', $token); |
390 | 390 | } |
391 | 391 | |
@@ -402,11 +402,11 @@ discard block |
||
402 | 402 | $dot = false; |
403 | 403 | } else { |
404 | 404 | // No alias is expected. |
405 | - if (! empty($options['breakOnAlias'])) { |
|
405 | + if (!empty($options['breakOnAlias'])) { |
|
406 | 406 | break; |
407 | 407 | } |
408 | 408 | |
409 | - if (! empty($ret->alias)) { |
|
409 | + if (!empty($ret->alias)) { |
|
410 | 410 | $parser->error('An alias was previously found.', $token); |
411 | 411 | break; |
412 | 412 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | $ret = implode('.', Context::escape($fields)); |
468 | 468 | } |
469 | 469 | |
470 | - if (! empty($component->alias)) { |
|
470 | + if (!empty($component->alias)) { |
|
471 | 471 | $ret .= ' AS ' . Context::escape($component->alias); |
472 | 472 | } |
473 | 473 |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $state = 4; |
245 | 245 | } elseif ($token->type === Token::TYPE_SYMBOL || $token->type === Token::TYPE_NONE) { |
246 | 246 | $expr->name = $token->value; |
247 | - if (! $expr->isConstraint) { |
|
247 | + if (!$expr->isConstraint) { |
|
248 | 248 | $state = 2; |
249 | 249 | } |
250 | 250 | } elseif ($token->type === Token::TYPE_KEYWORD) { |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | $state = 5; |
290 | 290 | } elseif ($state === 5) { |
291 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
291 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
292 | 292 | $ret[] = $expr; |
293 | 293 | } |
294 | 294 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | } |
312 | 312 | |
313 | 313 | // Last iteration was not saved. |
314 | - if (! empty($expr->type) || ! empty($expr->key)) { |
|
314 | + if (!empty($expr->type) || !empty($expr->key)) { |
|
315 | 315 | $ret[] = $expr; |
316 | 316 | } |
317 | 317 | |
@@ -349,18 +349,18 @@ discard block |
||
349 | 349 | $tmp .= Context::escape($component->name) . ' '; |
350 | 350 | } |
351 | 351 | |
352 | - if (! empty($component->type)) { |
|
352 | + if (!empty($component->type)) { |
|
353 | 353 | $tmp .= DataType::build( |
354 | 354 | $component->type, |
355 | 355 | ['lowercase' => true] |
356 | 356 | ) . ' '; |
357 | 357 | } |
358 | 358 | |
359 | - if (! empty($component->key)) { |
|
359 | + if (!empty($component->key)) { |
|
360 | 360 | $tmp .= $component->key . ' '; |
361 | 361 | } |
362 | 362 | |
363 | - if (! empty($component->references)) { |
|
363 | + if (!empty($component->references)) { |
|
364 | 364 | $tmp .= 'REFERENCES ' . $component->references . ' '; |
365 | 365 | } |
366 | 366 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } elseif (($token->type === Token::TYPE_OPERATOR) |
100 | 100 | && ($token->value === ',') |
101 | 101 | ) { |
102 | - if (! empty($expr->expr)) { |
|
102 | + if (!empty($expr->expr)) { |
|
103 | 103 | $ret[] = $expr; |
104 | 104 | } |
105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | // Last iteration was not processed. |
115 | - if (! empty($expr->expr)) { |
|
115 | + if (!empty($expr->expr)) { |
|
116 | 116 | $ret[] = $expr; |
117 | 117 | } |
118 | 118 |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } elseif (($token->type === Token::TYPE_OPERATOR) |
94 | 94 | && ($token->value === ',') |
95 | 95 | ) { |
96 | - if (! empty($expr->expr)) { |
|
96 | + if (!empty($expr->expr)) { |
|
97 | 97 | $ret[] = $expr; |
98 | 98 | } |
99 | 99 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | // Last iteration was not processed. |
109 | - if (! empty($expr->expr)) { |
|
109 | + if (!empty($expr->expr)) { |
|
110 | 110 | $ret[] = $expr; |
111 | 111 | } |
112 | 112 |
@@ -249,7 +249,7 @@ |
||
249 | 249 | return trim( |
250 | 250 | 'PARTITION ' . $component->name |
251 | 251 | . (empty($component->type) ? '' : ' VALUES ' . $component->type . ' ' . $component->expr . ' ') |
252 | - . (! empty($component->options) && ! empty($component->type) ? '' : ' ') |
|
252 | + . (!empty($component->options) && !empty($component->type) ? '' : ' ') |
|
253 | 253 | . $component->options . $subpartitions |
254 | 254 | ); |
255 | 255 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | // The code below extracts only the relevant information. |
72 | 72 | |
73 | 73 | // Extracting lexer's errors. |
74 | - if (! empty($lexer->errors)) { |
|
74 | + if (!empty($lexer->errors)) { |
|
75 | 75 | foreach ($lexer->errors as $err) { |
76 | 76 | $lexerErrors[] = [ |
77 | 77 | $err->getMessage(), |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | // Extracting parser's errors. |
88 | - if (! empty($parser->errors)) { |
|
88 | + if (!empty($parser->errors)) { |
|
89 | 89 | foreach ($parser->errors as $err) { |
90 | 90 | $parserErrors[] = [ |
91 | 91 | $err->getMessage(), |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | public static function build($type, $input, $output, $debug = null, $ansi = false) |
123 | 123 | { |
124 | 124 | // Support query types: `lexer` / `parser`. |
125 | - if (! in_array($type, ['lexer', 'parser'])) { |
|
125 | + if (!in_array($type, ['lexer', 'parser'])) { |
|
126 | 126 | throw new Exception('Unknown test type (expected `lexer` or `parser`).'); |
127 | 127 | } |
128 | 128 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | file_put_contents($output, serialize($test)); |
153 | 153 | |
154 | 154 | // Dumping test's data in human readable format too (if required). |
155 | - if (! empty($debug)) { |
|
155 | + if (!empty($debug)) { |
|
156 | 156 | file_put_contents($debug, print_r($test, true)); |
157 | 157 | } |
158 | 158 | } |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | if (is_dir($inputFile)) { |
183 | 183 | // Creating required directories to maintain the structure. |
184 | 184 | // Ignoring errors if the folder structure exists already. |
185 | - if (! is_dir($outputFile)) { |
|
185 | + if (!is_dir($outputFile)) { |
|
186 | 186 | mkdir($outputFile); |
187 | 187 | } |
188 | 188 | |
189 | - if (($debug !== null) && (! is_dir($debugFile))) { |
|
189 | + if (($debug !== null) && (!is_dir($debugFile))) { |
|
190 | 190 | mkdir($debugFile); |
191 | 191 | } |
192 | 192 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | // Building the test. |
204 | - if (! file_exists($outputFile)) { |
|
204 | + if (!file_exists($outputFile)) { |
|
205 | 205 | sprintf("Building test for %s...\n", $inputFile); |
206 | 206 | static::build( |
207 | 207 | strpos($inputFile, 'lex') !== false ? 'lexer' : 'parser', |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | $value = strtoupper($value); |
175 | - if (! isset($types[$value])) { |
|
175 | + if (!isset($types[$value])) { |
|
176 | 176 | $types[$value] = $type; |
177 | 177 | } else { |
178 | 178 | $types[$value] |= $type; |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | $ret = []; |
183 | 183 | foreach ($types as $word => $type) { |
184 | 184 | $len = strlen($word); |
185 | - if (! isset($ret[$type])) { |
|
185 | + if (!isset($ret[$type])) { |
|
186 | 186 | $ret[$type] = []; |
187 | 187 | } |
188 | 188 | |
189 | - if (! isset($ret[$type][$len])) { |
|
189 | + if (!isset($ret[$type][$len])) { |
|
190 | 190 | $ret[$type][$len] = []; |
191 | 191 | } |
192 | 192 |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | // Checking if this field was already built. |
171 | 171 | if ($type & 1) { |
172 | - if (! empty($built[$field])) { |
|
172 | + if (!empty($built[$field])) { |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | $options = []; |
313 | 313 | |
314 | 314 | // Looking for duplicated clauses. |
315 | - if (! empty(Parser::$KEYWORD_PARSERS[$token->value]) |
|
316 | - || ! empty(Parser::$STATEMENT_PARSERS[$token->value]) |
|
315 | + if (!empty(Parser::$KEYWORD_PARSERS[$token->value]) |
|
316 | + || !empty(Parser::$STATEMENT_PARSERS[$token->value]) |
|
317 | 317 | ) { |
318 | - if (! empty($parsedClauses[$token->value])) { |
|
318 | + if (!empty($parsedClauses[$token->value])) { |
|
319 | 319 | $parser->error( |
320 | 320 | 'This type of clause was previously parsed.', |
321 | 321 | $token |
@@ -331,17 +331,17 @@ discard block |
||
331 | 331 | // but it might be the beginning of a statement of truncate, |
332 | 332 | // so let the value use the keyword field for truncate type. |
333 | 333 | $token_value = in_array($token->keyword, ['TRUNCATE']) ? $token->keyword : $token->value; |
334 | - if (! empty(Parser::$KEYWORD_PARSERS[$token_value]) && $list->idx < $list->count) { |
|
334 | + if (!empty(Parser::$KEYWORD_PARSERS[$token_value]) && $list->idx < $list->count) { |
|
335 | 335 | $class = Parser::$KEYWORD_PARSERS[$token_value]['class']; |
336 | 336 | $field = Parser::$KEYWORD_PARSERS[$token_value]['field']; |
337 | - if (! empty(Parser::$KEYWORD_PARSERS[$token_value]['options'])) { |
|
337 | + if (!empty(Parser::$KEYWORD_PARSERS[$token_value]['options'])) { |
|
338 | 338 | $options = Parser::$KEYWORD_PARSERS[$token_value]['options']; |
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | 342 | // Checking if this is the beginning of the statement. |
343 | - if (! empty(Parser::$STATEMENT_PARSERS[$token->keyword])) { |
|
344 | - if (! empty(static::$CLAUSES) // Undefined for some statements. |
|
343 | + if (!empty(Parser::$STATEMENT_PARSERS[$token->keyword])) { |
|
344 | + if (!empty(static::$CLAUSES) // Undefined for some statements. |
|
345 | 345 | && empty(static::$CLAUSES[$token->value]) |
346 | 346 | ) { |
347 | 347 | // Some keywords (e.g. `SET`) may be the beginning of a |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | break; |
357 | 357 | } |
358 | 358 | |
359 | - if (! $parsedOptions) { |
|
359 | + if (!$parsedOptions) { |
|
360 | 360 | if (empty(static::$OPTIONS[$token->value])) { |
361 | 361 | // Skipping keyword because if it is not a option. |
362 | 362 | ++$list->idx; |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | if ($minJoin === 0 && stripos($clauseType, 'JOIN')) { |
540 | 540 | // First JOIN clause is detected |
541 | 541 | $minJoin = $maxJoin = $clauseStartIdx; |
542 | - } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) { |
|
542 | + } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) { |
|
543 | 543 | // After a previous JOIN clause, a non-JOIN clause has been detected |
544 | 544 | $maxJoin = $lastIdx; |
545 | 545 | } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) { |