@@ -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; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | $value = strtoupper($value); |
158 | - if (! isset($types[$value])) { |
|
158 | + if (!isset($types[$value])) { |
|
159 | 159 | $types[$value] = $type; |
160 | 160 | } else { |
161 | 161 | $types[$value] |= $type; |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | $ret = array(); |
166 | 166 | foreach ($types as $word => $type) { |
167 | 167 | $len = strlen($word); |
168 | - if (! isset($ret[$type])) { |
|
168 | + if (!isset($ret[$type])) { |
|
169 | 169 | $ret[$type] = array(); |
170 | 170 | } |
171 | - if (! isset($ret[$type][$len])) { |
|
171 | + if (!isset($ret[$type][$len])) { |
|
172 | 172 | $ret[$type][$len] = array(); |
173 | 173 | } |
174 | 174 | $ret[$type][$len][] = $word; |
@@ -389,9 +389,9 @@ discard block |
||
389 | 389 | $output = rtrim($argv[2], '/'); |
390 | 390 | |
391 | 391 | // Checking if all directories are valid. |
392 | - if (! is_dir($input)) { |
|
392 | + if (!is_dir($input)) { |
|
393 | 393 | throw new \Exception('The input directory does not exist.'); |
394 | - } elseif (! is_dir($output)) { |
|
394 | + } elseif (!is_dir($output)) { |
|
395 | 395 | throw new \Exception('The output directory does not exist.'); |
396 | 396 | } |
397 | 397 |
@@ -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 | $expr = new self(); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | // Last iteration was not processed. |
108 | - if (! empty($expr->expr)) { |
|
108 | + if (!empty($expr->expr)) { |
|
109 | 109 | $ret[] = $expr; |
110 | 110 | } |
111 | 111 |
@@ -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(), |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | public static function build($type, $input, $output, $debug = null, $ansi = false) |
111 | 111 | { |
112 | 112 | // Support query types: `lexer` / `parser`. |
113 | - if (! in_array($type, array('lexer', 'parser'))) { |
|
113 | + if (!in_array($type, array('lexer', 'parser'))) { |
|
114 | 114 | throw new \Exception('Unknown test type (expected `lexer` or `parser`).'); |
115 | 115 | } |
116 | 116 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | file_put_contents($output, serialize($test)); |
141 | 141 | |
142 | 142 | // Dumping test's data in human readable format too (if required). |
143 | - if (! empty($debug)) { |
|
143 | + if (!empty($debug)) { |
|
144 | 144 | file_put_contents($debug, print_r($test, true)); |
145 | 145 | } |
146 | 146 | } |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | if (is_dir($inputFile)) { |
171 | 171 | // Creating required directories to maintain the structure. |
172 | 172 | // Ignoring errors if the folder structure exists already. |
173 | - if (! is_dir($outputFile)) { |
|
173 | + if (!is_dir($outputFile)) { |
|
174 | 174 | mkdir($outputFile); |
175 | 175 | } |
176 | - if (($debug !== null) && (! is_dir($debugFile))) { |
|
176 | + if (($debug !== null) && (!is_dir($debugFile))) { |
|
177 | 177 | mkdir($debugFile); |
178 | 178 | } |
179 | 179 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | // Building the test. |
191 | - if (! file_exists($outputFile)) { |
|
191 | + if (!file_exists($outputFile)) { |
|
192 | 192 | sprintf("Building test for %s...\n", $inputFile); |
193 | 193 | static::build( |
194 | 194 | strpos($inputFile, 'lex') !== false ? 'lexer' : 'parser', |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | $debug = empty($argv[3]) ? null : rtrim($argv[3], '/'); |
223 | 223 | |
224 | 224 | // Checking if all directories are valid. |
225 | - if (! is_dir($input)) { |
|
225 | + if (!is_dir($input)) { |
|
226 | 226 | throw new \Exception('The input directory does not exist.'); |
227 | - } elseif (! is_dir($output)) { |
|
227 | + } elseif (!is_dir($output)) { |
|
228 | 228 | throw new \Exception('The output directory does not exist.'); |
229 | - } elseif (($debug !== null) && (! is_dir($debug))) { |
|
229 | + } elseif (($debug !== null) && (!is_dir($debug))) { |
|
230 | 230 | throw new \Exception('The debug directory does not exist.'); |
231 | 231 | } |
232 | 232 |