Passed
Pull Request — master (#303)
by William
09:48
created
src/Utils/BufferedQuery.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
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/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.
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.