@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | public static function getForeignKeys($statement) |
28 | 28 | { |
29 | 29 | if (empty($statement->fields) |
30 | - || (! is_array($statement->fields)) |
|
31 | - || (! $statement->options->has('TABLE')) |
|
30 | + || (!is_array($statement->fields)) |
|
31 | + || (!$statement->options->has('TABLE')) |
|
32 | 32 | ) { |
33 | 33 | return array(); |
34 | 34 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'index_list' => $columns |
51 | 51 | ); |
52 | 52 | |
53 | - if (! empty($field->references)) { |
|
53 | + if (!empty($field->references)) { |
|
54 | 54 | $tmp['ref_db_name'] = $field->references->table->database; |
55 | 55 | $tmp['ref_table_name'] = $field->references->table->table; |
56 | 56 | $tmp['ref_index_list'] = $field->references->columns; |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | public static function getFields($statement) |
85 | 85 | { |
86 | 86 | if (empty($statement->fields) |
87 | - || (! is_array($statement->fields)) |
|
88 | - || (! $statement->options->has('TABLE')) |
|
87 | + || (!is_array($statement->fields)) |
|
88 | + || (!$statement->options->has('TABLE')) |
|
89 | 89 | ) { |
90 | 90 | return array(); |
91 | 91 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | // Parsing the delimiter. |
315 | 315 | $delimiter = ''; |
316 | - while (($i < $len) && (! Context::isWhitespace($this->query[$i]))) { |
|
316 | + while (($i < $len) && (!Context::isWhitespace($this->query[$i]))) { |
|
317 | 317 | $delimiter .= $this->query[$i++]; |
318 | 318 | } |
319 | 319 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | // Whether this statement should be returned or not. |
329 | 329 | $ret = ''; |
330 | - if (! empty($this->options['parse_delimiter'])) { |
|
330 | + if (!empty($this->options['parse_delimiter'])) { |
|
331 | 331 | // Appending the `DELIMITER` statement that was just |
332 | 332 | // found to the current statement. |
333 | 333 | $ret = trim( |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $ret = $this->current; |
370 | 370 | |
371 | 371 | // If needed, adds a delimiter at the end of the statement. |
372 | - if (! empty($this->options['add_delimiter'])) { |
|
372 | + if (!empty($this->options['add_delimiter'])) { |
|
373 | 373 | $ret .= $this->delimiter; |
374 | 374 | } |
375 | 375 |
@@ -44,7 +44,7 @@ |
||
44 | 44 | */ |
45 | 45 | public function __construct(array $tokens = array(), $count = -1) |
46 | 46 | { |
47 | - if (! empty($tokens)) { |
|
47 | + if (!empty($tokens)) { |
|
48 | 48 | $this->tokens = $tokens; |
49 | 49 | if ($count === -1) { |
50 | 50 | $this->count = count($tokens); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | // Checking if this field was already built. |
170 | 170 | if ($type & 1) { |
171 | - if (! empty($built[$field])) { |
|
171 | + if (!empty($built[$field])) { |
|
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | $built[$field] = true; |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | $options = array(); |
307 | 307 | |
308 | 308 | // Looking for duplicated clauses. |
309 | - if (! empty(Parser::$KEYWORD_PARSERS[$token->value]) |
|
310 | - || ! empty(Parser::$STATEMENT_PARSERS[$token->value]) |
|
309 | + if (!empty(Parser::$KEYWORD_PARSERS[$token->value]) |
|
310 | + || !empty(Parser::$STATEMENT_PARSERS[$token->value]) |
|
311 | 311 | ) { |
312 | - if (! empty($parsedClauses[$token->value])) { |
|
312 | + if (!empty($parsedClauses[$token->value])) { |
|
313 | 313 | $parser->error( |
314 | 314 | 'This type of clause was previously parsed.', |
315 | 315 | $token |
@@ -324,17 +324,17 @@ discard block |
||
324 | 324 | // but it might be the beginning of a statement of truncate, |
325 | 325 | // so let the value use the keyword field for truncate type. |
326 | 326 | $token_value = in_array($token->keyword, array('TRUNCATE')) ? $token->keyword : $token->value; |
327 | - if (! empty(Parser::$KEYWORD_PARSERS[$token_value]) && $list->idx < $list->count) { |
|
327 | + if (!empty(Parser::$KEYWORD_PARSERS[$token_value]) && $list->idx < $list->count) { |
|
328 | 328 | $class = Parser::$KEYWORD_PARSERS[$token_value]['class']; |
329 | 329 | $field = Parser::$KEYWORD_PARSERS[$token_value]['field']; |
330 | - if (! empty(Parser::$KEYWORD_PARSERS[$token_value]['options'])) { |
|
330 | + if (!empty(Parser::$KEYWORD_PARSERS[$token_value]['options'])) { |
|
331 | 331 | $options = Parser::$KEYWORD_PARSERS[$token_value]['options']; |
332 | 332 | } |
333 | 333 | } |
334 | 334 | |
335 | 335 | // Checking if this is the beginning of the statement. |
336 | - if (! empty(Parser::$STATEMENT_PARSERS[$token->keyword])) { |
|
337 | - if (! empty(static::$CLAUSES) // Undefined for some statements. |
|
336 | + if (!empty(Parser::$STATEMENT_PARSERS[$token->keyword])) { |
|
337 | + if (!empty(static::$CLAUSES) // Undefined for some statements. |
|
338 | 338 | && empty(static::$CLAUSES[$token->value]) |
339 | 339 | ) { |
340 | 340 | // Some keywords (e.g. `SET`) may be the beginning of a |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | ); |
349 | 349 | break; |
350 | 350 | } |
351 | - if (! $parsedOptions) { |
|
351 | + if (!$parsedOptions) { |
|
352 | 352 | if (empty(static::$OPTIONS[$token->value])) { |
353 | 353 | // Skipping keyword because if it is not a option. |
354 | 354 | ++$list->idx; |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | if ($minJoin === 0 && stripos($clauseType, 'JOIN')) { |
529 | 529 | // First JOIN clause is detected |
530 | 530 | $minJoin = $maxJoin = $clauseStartIdx; |
531 | - } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) { |
|
531 | + } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) { |
|
532 | 532 | // After a previous JOIN clause, a non-JOIN clause has been detected |
533 | 533 | $maxJoin = $lastIdx; |
534 | 534 | } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) { |
@@ -58,7 +58,7 @@ |
||
58 | 58 | */ |
59 | 59 | public static function gettext($msgid) |
60 | 60 | { |
61 | - if (! class_exists('\PhpMyAdmin\MoTranslator\Loader', true)) { |
|
61 | + if (!class_exists('\PhpMyAdmin\MoTranslator\Loader', true)) { |
|
62 | 62 | return $msgid; |
63 | 63 | } |
64 | 64 |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | // Checking if it is a known statement that can be parsed. |
472 | 472 | if (empty(static::$STATEMENT_PARSERS[$token->keyword])) { |
473 | - if (! isset(static::$STATEMENT_PARSERS[$token->keyword])) { |
|
473 | + if (!isset(static::$STATEMENT_PARSERS[$token->keyword])) { |
|
474 | 474 | // A statement is considered recognized if the parser |
475 | 475 | // is aware that it is a statement, but it does not have |
476 | 476 | // a parser for it yet. |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | $prevLastIdx = $list->idx; |
512 | 512 | |
513 | 513 | // Handles unions. |
514 | - if (! empty($unionType) |
|
514 | + if (!empty($unionType) |
|
515 | 515 | && ($lastStatement instanceof SelectStatement) |
516 | 516 | && ($statement instanceof SelectStatement) |
517 | 517 | ) { |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | use PhpMyAdmin\SqlParser\Exceptions\LexerException; |
14 | 14 | |
15 | -if (! defined('USE_UTF_STRINGS')) { |
|
15 | +if (!defined('USE_UTF_STRINGS')) { |
|
16 | 16 | // NOTE: In previous versions of PHP (5.5 and older) the default |
17 | 17 | // internal encoding is "ISO-8859-1". |
18 | 18 | // All `mb_` functions must specify the correct encoding, which is |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | // For multi-byte strings, a new instance of `UtfString` is |
175 | 175 | // initialized (only if `UtfString` usage is forced. |
176 | - if (! $str instanceof UtfString && USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) { |
|
176 | + if (!$str instanceof UtfString && USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) { |
|
177 | 177 | $str = new UtfString($str); |
178 | 178 | } |
179 | 179 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | // Setting the delimiter. |
186 | 186 | $this->setDelimiter( |
187 | - ! empty($delimiter) ? $delimiter : static::$DEFAULT_DELIMITER |
|
187 | + !empty($delimiter) ? $delimiter : static::$DEFAULT_DELIMITER |
|
188 | 188 | ); |
189 | 189 | |
190 | 190 | $this->lex(); |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | // Parsing the delimiter. |
313 | 313 | $this->delimiter = null; |
314 | 314 | $delimiterLen = 0; |
315 | - while (++$this->last < $this->len && ! Context::isWhitespace($this->str[$this->last]) && $delimiterLen < 15) { |
|
315 | + while (++$this->last < $this->len && !Context::isWhitespace($this->str[$this->last]) && $delimiterLen < 15) { |
|
316 | 316 | $this->delimiter .= $this->str[$this->last]; |
317 | 317 | ++$delimiterLen; |
318 | 318 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | { |
518 | 518 | $token = $this->str[$this->last]; |
519 | 519 | |
520 | - if (! Context::isWhitespace($token)) { |
|
520 | + if (!Context::isWhitespace($token)) { |
|
521 | 521 | return null; |
522 | 522 | } |
523 | 523 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | // This can occurs in the following statements: |
564 | 564 | // - "SELECT */* comment */ FROM ..." |
565 | 565 | // - "SELECT 2*/* comment */3 AS `six`;" |
566 | - $next = $this->last+1; |
|
566 | + $next = $this->last + 1; |
|
567 | 567 | if (($next < $this->len) && $this->str[$next] === '*') { |
568 | 568 | // Conflict in "*/*": first "*" was not for ending a comment. |
569 | 569 | // Stop here and let other parsing method define the true behavior of that first star. |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | } |
753 | 753 | } elseif ($state === 2) { |
754 | 754 | $flags |= Token::FLAG_NUMBER_HEX; |
755 | - if (! ( |
|
755 | + if (!( |
|
756 | 756 | ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') |
757 | 757 | || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F') |
758 | 758 | || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f') |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | public function parseString($quote = '') |
835 | 835 | { |
836 | 836 | $token = $this->str[$this->last]; |
837 | - if (! ($flags = Context::isString($token)) && $token !== $quote) { |
|
837 | + if (!($flags = Context::isString($token)) && $token !== $quote) { |
|
838 | 838 | return null; |
839 | 839 | } |
840 | 840 | $quote = $token; |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | public function parseSymbol() |
880 | 880 | { |
881 | 881 | $token = $this->str[$this->last]; |
882 | - if (! ($flags = Context::isSymbol($token))) { |
|
882 | + if (!($flags = Context::isSymbol($token))) { |
|
883 | 883 | return null; |
884 | 884 | } |
885 | 885 | |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | return null; |
931 | 931 | } |
932 | 932 | |
933 | - while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) { |
|
933 | + while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) { |
|
934 | 934 | $token .= $this->str[$this->last]; |
935 | 935 | } |
936 | 936 | --$this->last; |
@@ -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 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | // The code below extracts only the relevant information. |
62 | 62 | |
63 | 63 | // Extracting lexer's errors. |
64 | - if (! empty($lexer->errors)) { |
|
64 | + if (!empty($lexer->errors)) { |
|
65 | 65 | foreach ($lexer->errors as $err) { |
66 | 66 | $lexerErrors[] = array( |
67 | 67 | $err->getMessage(), |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | // Extracting parser's errors. |
77 | - if (! empty($parser->errors)) { |
|
77 | + if (!empty($parser->errors)) { |
|
78 | 78 | foreach ($parser->errors as $err) { |
79 | 79 | $parserErrors[] = array( |
80 | 80 | $err->getMessage(), |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | public static function build($type, $input, $output, $debug = null) |
110 | 110 | { |
111 | 111 | // Support query types: `lexer` / `parser`. |
112 | - if (! in_array($type, array('lexer', 'parser'))) { |
|
112 | + if (!in_array($type, array('lexer', 'parser'))) { |
|
113 | 113 | throw new \Exception('Unknown test type (expected `lexer` or `parser`).'); |
114 | 114 | } |
115 | 115 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | file_put_contents($output, serialize($test)); |
132 | 132 | |
133 | 133 | // Dumping test's data in human readable format too (if required). |
134 | - if (! empty($debug)) { |
|
134 | + if (!empty($debug)) { |
|
135 | 135 | file_put_contents($debug, print_r($test, true)); |
136 | 136 | } |
137 | 137 | } |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | if (is_dir($inputFile)) { |
162 | 162 | // Creating required directories to maintain the structure. |
163 | 163 | // Ignoring errors if the folder structure exists already. |
164 | - if (! is_dir($outputFile)) { |
|
164 | + if (!is_dir($outputFile)) { |
|
165 | 165 | mkdir($outputFile); |
166 | 166 | } |
167 | - if (($debug !== null) && (! is_dir($debugFile))) { |
|
167 | + if (($debug !== null) && (!is_dir($debugFile))) { |
|
168 | 168 | mkdir($debugFile); |
169 | 169 | } |
170 | 170 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | // Building the test. |
182 | - if (! file_exists($outputFile)) { |
|
182 | + if (!file_exists($outputFile)) { |
|
183 | 183 | sprintf("Building test for %s...\n", $inputFile); |
184 | 184 | static::build( |
185 | 185 | strpos($inputFile, 'lex') !== false ? 'lexer' : 'parser', |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | $debug = empty($argv[3]) ? null : rtrim($argv[3], '/'); |
213 | 213 | |
214 | 214 | // Checking if all directories are valid. |
215 | - if (! is_dir($input)) { |
|
215 | + if (!is_dir($input)) { |
|
216 | 216 | throw new \Exception('The input directory does not exist.'); |
217 | - } elseif (! is_dir($output)) { |
|
217 | + } elseif (!is_dir($output)) { |
|
218 | 218 | throw new \Exception('The output directory does not exist.'); |
219 | - } elseif (($debug !== null) && (! is_dir($debug))) { |
|
219 | + } elseif (($debug !== null) && (!is_dir($debug))) { |
|
220 | 220 | throw new \Exception('The debug directory does not exist.'); |
221 | 221 | } |
222 | 222 |