Passed
Pull Request — master (#324)
by William
10:10
created
src/TokensList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Statement.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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')) {
Please login to merge, or discard this patch.
src/Translator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
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/Context.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
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.
src/Components/OrderKeyword.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
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(),
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
tests/Utils/CLITest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
      */
428 428
     public function testStdinPipe($cmd, $result)
429 429
     {
430
-        exec ($cmd, $out, $ret);
430
+        exec($cmd, $out, $ret);
431 431
         $this->assertSame($result, $ret);
432 432
     }
433 433
 
@@ -440,12 +440,12 @@  discard block
 block discarded – undo
440 440
         }
441 441
 
442 442
         return array(
443
-            array('echo "SELECT 1" | '. $binPath .'highlight-query', 0),
444
-            array('echo "invalid query" | '. $binPath .'highlight-query', 0),
445
-            array('echo "SELECT 1" | '. $binPath .'lint-query', 0),
446
-            array('echo "invalid query" | '. $binPath .'lint-query', 10),
447
-            array('echo "SELECT 1" | '. $binPath .'tokenize-query', 0),
448
-            array('echo "invalid query" | '. $binPath .'tokenize-query', 0)
443
+            array('echo "SELECT 1" | ' . $binPath . 'highlight-query', 0),
444
+            array('echo "invalid query" | ' . $binPath . 'highlight-query', 0),
445
+            array('echo "SELECT 1" | ' . $binPath . 'lint-query', 0),
446
+            array('echo "invalid query" | ' . $binPath . 'lint-query', 10),
447
+            array('echo "SELECT 1" | ' . $binPath . 'tokenize-query', 0),
448
+            array('echo "invalid query" | ' . $binPath . 'tokenize-query', 0)
449 449
         );
450 450
     }
451 451
 }
Please login to merge, or discard this patch.