Passed
Pull Request — master (#287)
by William
07:56
created
src/Parser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             ) {
Please login to merge, or discard this patch.
src/Lexer.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
tools/TestGenerator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
tools/ContextGenerator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.