@@ -194,7 +194,7 @@ |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
197 | - * @param PartitionDefinition|PartitionDefinition[] $component the component to be built |
|
197 | + * @param PartitionDefinition[] $component the component to be built |
|
198 | 198 | * @param array $options parameters for building |
199 | 199 | * |
200 | 200 | * @return string |
@@ -247,7 +247,7 @@ |
||
247 | 247 | return trim( |
248 | 248 | 'PARTITION ' . $component->name |
249 | 249 | . (empty($component->type) ? '' : ' VALUES ' . $component->type . ' ' . $component->expr . ' ') |
250 | - . ((! empty($component->options) && ! empty($component->type)) ? '' : ' ') . $component->options . $subpartitions |
|
250 | + . ((!empty($component->options) && !empty($component->type)) ? '' : ' ') . $component->options . $subpartitions |
|
251 | 251 | ); |
252 | 252 | } |
253 | 253 | } |
@@ -499,7 +499,7 @@ |
||
499 | 499 | * @param Statement $statement the parsed query that has to be modified |
500 | 500 | * @param TokensList $list the list of tokens |
501 | 501 | * @param string $clause the clause to be returned |
502 | - * @param int|string $type The type of the search. |
|
502 | + * @param integer $type The type of the search. |
|
503 | 503 | * If int, |
504 | 504 | * -1 for everything that was before |
505 | 505 | * 0 only for the clause |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $flags['querytype'] = 'SELECT'; |
228 | 228 | $flags['is_select'] = true; |
229 | 229 | |
230 | - if (! empty($statement->from)) { |
|
230 | + if (!empty($statement->from)) { |
|
231 | 231 | $flags['select_from'] = true; |
232 | 232 | } |
233 | 233 | |
@@ -235,55 +235,55 @@ discard block |
||
235 | 235 | $flags['distinct'] = true; |
236 | 236 | } |
237 | 237 | |
238 | - if (! empty($statement->group) || ! empty($statement->having)) { |
|
238 | + if (!empty($statement->group) || !empty($statement->having)) { |
|
239 | 239 | $flags['is_group'] = true; |
240 | 240 | } |
241 | 241 | |
242 | - if (! empty($statement->into) |
|
242 | + if (!empty($statement->into) |
|
243 | 243 | && ($statement->into->type === 'OUTFILE') |
244 | 244 | ) { |
245 | 245 | $flags['is_export'] = true; |
246 | 246 | } |
247 | 247 | |
248 | 248 | $expressions = $statement->expr; |
249 | - if (! empty($statement->join)) { |
|
249 | + if (!empty($statement->join)) { |
|
250 | 250 | foreach ($statement->join as $join) { |
251 | 251 | $expressions[] = $join->expr; |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | foreach ($expressions as $expr) { |
256 | - if (! empty($expr->function)) { |
|
256 | + if (!empty($expr->function)) { |
|
257 | 257 | if ($expr->function === 'COUNT') { |
258 | 258 | $flags['is_count'] = true; |
259 | 259 | } elseif (in_array($expr->function, static::$FUNCTIONS)) { |
260 | 260 | $flags['is_func'] = true; |
261 | 261 | } |
262 | 262 | } |
263 | - if (! empty($expr->subquery)) { |
|
263 | + if (!empty($expr->subquery)) { |
|
264 | 264 | $flags['is_subquery'] = true; |
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - if (! empty($statement->procedure) |
|
268 | + if (!empty($statement->procedure) |
|
269 | 269 | && ($statement->procedure->name === 'ANALYSE') |
270 | 270 | ) { |
271 | 271 | $flags['is_analyse'] = true; |
272 | 272 | } |
273 | 273 | |
274 | - if (! empty($statement->group)) { |
|
274 | + if (!empty($statement->group)) { |
|
275 | 275 | $flags['group'] = true; |
276 | 276 | } |
277 | 277 | |
278 | - if (! empty($statement->having)) { |
|
278 | + if (!empty($statement->having)) { |
|
279 | 279 | $flags['having'] = true; |
280 | 280 | } |
281 | 281 | |
282 | - if (! empty($statement->union)) { |
|
282 | + if (!empty($statement->union)) { |
|
283 | 283 | $flags['union'] = true; |
284 | 284 | } |
285 | 285 | |
286 | - if (! empty($statement->join)) { |
|
286 | + if (!empty($statement->join)) { |
|
287 | 287 | $flags['join'] = true; |
288 | 288 | } |
289 | 289 | |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | || ($statement instanceof UpdateStatement) |
375 | 375 | || ($statement instanceof DeleteStatement) |
376 | 376 | ) { |
377 | - if (! empty($statement->limit)) { |
|
377 | + if (!empty($statement->limit)) { |
|
378 | 378 | $flags['limit'] = true; |
379 | 379 | } |
380 | - if (! empty($statement->order)) { |
|
380 | + if (!empty($statement->order)) { |
|
381 | 381 | $flags['order'] = true; |
382 | 382 | } |
383 | 383 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | $expr->database : null |
446 | 446 | ); |
447 | 447 | } |
448 | - if (! in_array($arr, $ret['select_tables'])) { |
|
448 | + if (!in_array($arr, $ret['select_tables'])) { |
|
449 | 449 | $ret['select_tables'][] = $arr; |
450 | 450 | } |
451 | 451 | } else { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | (isset($expr->database) && ($expr->database !== '')) ? |
465 | 465 | $expr->database : null |
466 | 466 | ); |
467 | - if (! in_array($arr, $ret['select_tables'])) { |
|
467 | + if (!in_array($arr, $ret['select_tables'])) { |
|
468 | 468 | $ret['select_tables'][] = $arr; |
469 | 469 | } |
470 | 470 | } |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | ) { |
502 | 502 | $expressions = array($statement->table); |
503 | 503 | } elseif ($statement instanceof DropStatement) { |
504 | - if (! $statement->options->has('TABLE')) { |
|
504 | + if (!$statement->options->has('TABLE')) { |
|
505 | 505 | // No tables are dropped. |
506 | 506 | return array(); |
507 | 507 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | $ret = array(); |
516 | 516 | foreach ($expressions as $expr) { |
517 | - if (! empty($expr->table)) { |
|
517 | + if (!empty($expr->table)) { |
|
518 | 518 | $expr->expr = null; // Force rebuild. |
519 | 519 | $expr->alias = null; // Aliases are not required. |
520 | 520 | $ret[] = Expression::build($expr); |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | |
787 | 787 | $statement .= $token->token; |
788 | 788 | |
789 | - if (($token->type === Token::TYPE_DELIMITER) && ! empty($token->token)) { |
|
789 | + if (($token->type === Token::TYPE_DELIMITER) && !empty($token->token)) { |
|
790 | 790 | $delimiter = $token->token; |
791 | 791 | $fullStatement = true; |
792 | 792 | break; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | |
796 | 796 | // No statement was found so we return the entire query as being the |
797 | 797 | // remaining part. |
798 | - if (! $fullStatement) { |
|
798 | + if (!$fullStatement) { |
|
799 | 799 | return array( |
800 | 800 | null, |
801 | 801 | $query, |
@@ -339,6 +339,11 @@ |
||
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | + /** |
|
343 | + * @param Parser $parser |
|
344 | + * @param TokensList $list |
|
345 | + * @param integer $state |
|
346 | + */ |
|
342 | 347 | public function parseKeywordsAccordingToState($parser, $list, $state) |
343 | 348 | { |
344 | 349 | $token = $list->tokens[$list->idx]; |
@@ -131,7 +131,7 @@ |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
134 | - * @param SetOperation|SetOperation[] $component the component to be built |
|
134 | + * @param SetOperation[] $component the component to be built |
|
135 | 135 | * @param array $options parameters for building |
136 | 136 | * |
137 | 137 | * @return string |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $this->byteIdx = 0; |
76 | 76 | $this->charIdx = 0; |
77 | 77 | $this->byteLen = mb_strlen($str, '8bit'); |
78 | - if (! mb_check_encoding($str, 'UTF-8')) { |
|
78 | + if (!mb_check_encoding($str, 'UTF-8')) { |
|
79 | 79 | $this->charLen = 0; |
80 | 80 | } else { |
81 | 81 | $this->charLen = mb_strlen($str, 'UTF-8'); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param TokensList $list the list of tokens that are being parsed |
40 | 40 | * @param array $options parameters for parsing |
41 | 41 | * |
42 | - * @return CaseExpression |
|
42 | + * @return LockExpression |
|
43 | 43 | */ |
44 | 44 | public static function parse(Parser $parser, TokensList $list, array $options = array()) |
45 | 45 | { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | - * @param LockExpression|LockExpression[] $component the component to be built |
|
101 | + * @param LockExpression[] $component the component to be built |
|
102 | 102 | * @param array $options parameters for building |
103 | 103 | * |
104 | 104 | * @return string |
@@ -326,7 +326,7 @@ |
||
326 | 326 | * Checks if the given string is the beginning of a whitespace. |
327 | 327 | * |
328 | 328 | * @param string $str string to be checked |
329 | - * @param mixed $end |
|
329 | + * @param boolean $end |
|
330 | 330 | * |
331 | 331 | * @return int|null the appropriate flag for the comment type |
332 | 332 | */ |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $str = strtoupper($str); |
276 | 276 | |
277 | 277 | if (isset(static::$KEYWORDS[$str])) { |
278 | - if ($isReserved && ! (static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) { |
|
278 | + if ($isReserved && !(static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) { |
|
279 | 279 | return null; |
280 | 280 | } |
281 | 281 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public static function isOperator($str) |
299 | 299 | { |
300 | - if (! isset(static::$OPERATORS[$str])) { |
|
300 | + if (!isset(static::$OPERATORS[$str])) { |
|
301 | 301 | return null; |
302 | 302 | } |
303 | 303 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | // Short context name (must be formatted into class name). |
490 | 490 | $context = self::$contextPrefix . $context; |
491 | 491 | } |
492 | - if (! class_exists($context)) { |
|
492 | + if (!class_exists($context)) { |
|
493 | 493 | throw @new LoaderException( |
494 | 494 | 'Specified context ("' . $context . '") does not exist.', |
495 | 495 | $context |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $i -= 2; |
527 | 527 | $part = substr($context, $i, 2); |
528 | 528 | /* No more numeric parts to strip */ |
529 | - if (! is_numeric($part)) { |
|
529 | + if (!is_numeric($part)) { |
|
530 | 530 | break 2; |
531 | 531 | } |
532 | 532 | } while (intval($part) === 0 && $i > 0); |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | } |
579 | 579 | |
580 | 580 | if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES) |
581 | - && (! static::isKeyword($str, true)) |
|
581 | + && (!static::isKeyword($str, true)) |
|
582 | 582 | ) { |
583 | 583 | return $str; |
584 | 584 | } |
@@ -125,7 +125,7 @@ |
||
125 | 125 | * |
126 | 126 | * @param Parser $parser the instance that requests parsing |
127 | 127 | * @param Token $token token to be parsed |
128 | - * @param Array $expected_keywords array of possibly expected keywords at this point |
|
128 | + * @param string[] $expected_keywords array of possibly expected keywords at this point |
|
129 | 129 | */ |
130 | 130 | private static function parseExpectedKeyword($parser, $token, $expected_keywords) |
131 | 131 | { |
@@ -7,7 +7,6 @@ |
||
7 | 7 | namespace PhpMyAdmin\SqlParser\Statements; |
8 | 8 | |
9 | 9 | use PhpMyAdmin\SqlParser\Components\Expression; |
10 | -use PhpMyAdmin\SqlParser\Components\OptionsArray; |
|
11 | 10 | use PhpMyAdmin\SqlParser\Parser; |
12 | 11 | use PhpMyAdmin\SqlParser\Statement; |
13 | 12 | use PhpMyAdmin\SqlParser\Token; |
@@ -95,7 +95,7 @@ |
||
95 | 95 | break; |
96 | 96 | } |
97 | 97 | } elseif ($state === 1) { |
98 | - if (! $this->isLock) { |
|
98 | + if (!$this->isLock) { |
|
99 | 99 | // UNLOCK statement should not have any more tokens |
100 | 100 | $parser->error('Unexpected token.', $token); |
101 | 101 | break; |