Passed
Pull Request — master (#334)
by Antoine
10:44 queued 43s
created
src/Components/PartitionDefinition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@
 block discarded – undo
249 249
         return trim(
250 250
             'PARTITION ' . $component->name
251 251
             . (empty($component->type) ? '' : ' VALUES ' . $component->type . ' ' . $component->expr . ' ')
252
-            . (! empty($component->options) && ! empty($component->type) ? '' : ' ')
252
+            . (!empty($component->options) && !empty($component->type) ? '' : ' ')
253 253
             . $component->options . $subpartitions
254 254
         );
255 255
     }
Please login to merge, or discard this patch.
src/Tools/TestGenerator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         // The code below extracts only the relevant information.
72 72
 
73 73
         // Extracting lexer's errors.
74
-        if (! empty($lexer->errors)) {
74
+        if (!empty($lexer->errors)) {
75 75
             foreach ($lexer->errors as $err) {
76 76
                 $lexerErrors[] = [
77 77
                     $err->getMessage(),
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         }
86 86
 
87 87
         // Extracting parser's errors.
88
-        if (! empty($parser->errors)) {
88
+        if (!empty($parser->errors)) {
89 89
             foreach ($parser->errors as $err) {
90 90
                 $parserErrors[] = [
91 91
                     $err->getMessage(),
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     public static function build($type, $input, $output, $debug = null, $ansi = false)
123 123
     {
124 124
         // Support query types: `lexer` / `parser`.
125
-        if (! in_array($type, ['lexer', 'parser'])) {
125
+        if (!in_array($type, ['lexer', 'parser'])) {
126 126
             throw new Exception('Unknown test type (expected `lexer` or `parser`).');
127 127
         }
128 128
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         file_put_contents($output, serialize($test));
153 153
 
154 154
         // Dumping test's data in human readable format too (if required).
155
-        if (! empty($debug)) {
155
+        if (!empty($debug)) {
156 156
             file_put_contents($debug, print_r($test, true));
157 157
         }
158 158
     }
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
             if (is_dir($inputFile)) {
183 183
                 // Creating required directories to maintain the structure.
184 184
                 // Ignoring errors if the folder structure exists already.
185
-                if (! is_dir($outputFile)) {
185
+                if (!is_dir($outputFile)) {
186 186
                     mkdir($outputFile);
187 187
                 }
188 188
 
189
-                if (($debug !== null) && (! is_dir($debugFile))) {
189
+                if (($debug !== null) && (!is_dir($debugFile))) {
190 190
                     mkdir($debugFile);
191 191
                 }
192 192
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                 }
202 202
 
203 203
                 // Building the test.
204
-                if (! file_exists($outputFile)) {
204
+                if (!file_exists($outputFile)) {
205 205
                     sprintf("Building test for %s...\n", $inputFile);
206 206
                     static::build(
207 207
                         strpos($inputFile, 'lex') !== false ? 'lexer' : 'parser',
Please login to merge, or discard this patch.
src/Tools/ContextGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             }
173 173
 
174 174
             $value = strtoupper($value);
175
-            if (! isset($types[$value])) {
175
+            if (!isset($types[$value])) {
176 176
                 $types[$value] = $type;
177 177
             } else {
178 178
                 $types[$value] |= $type;
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
         $ret = [];
183 183
         foreach ($types as $word => $type) {
184 184
             $len = strlen($word);
185
-            if (! isset($ret[$type])) {
185
+            if (!isset($ret[$type])) {
186 186
                 $ret[$type] = [];
187 187
             }
188 188
 
189
-            if (! isset($ret[$type][$len])) {
189
+            if (!isset($ret[$type][$len])) {
190 190
                 $ret[$type][$len] = [];
191 191
             }
192 192
 
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
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
             // Checking if this field was already built.
171 171
             if ($type & 1) {
172
-                if (! empty($built[$field])) {
172
+                if (!empty($built[$field])) {
173 173
                     continue;
174 174
                 }
175 175
 
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
             $options = [];
313 313
 
314 314
             // Looking for duplicated clauses.
315
-            if (! empty(Parser::$KEYWORD_PARSERS[$token->value])
316
-                || ! empty(Parser::$STATEMENT_PARSERS[$token->value])
315
+            if (!empty(Parser::$KEYWORD_PARSERS[$token->value])
316
+                || !empty(Parser::$STATEMENT_PARSERS[$token->value])
317 317
             ) {
318
-                if (! empty($parsedClauses[$token->value])) {
318
+                if (!empty($parsedClauses[$token->value])) {
319 319
                     $parser->error(
320 320
                         'This type of clause was previously parsed.',
321 321
                         $token
@@ -331,17 +331,17 @@  discard block
 block discarded – undo
331 331
             // but it might be the beginning of a statement of truncate,
332 332
             // so let the value use the keyword field for truncate type.
333 333
             $token_value = in_array($token->keyword, ['TRUNCATE']) ? $token->keyword : $token->value;
334
-            if (! empty(Parser::$KEYWORD_PARSERS[$token_value]) && $list->idx < $list->count) {
334
+            if (!empty(Parser::$KEYWORD_PARSERS[$token_value]) && $list->idx < $list->count) {
335 335
                 $class = Parser::$KEYWORD_PARSERS[$token_value]['class'];
336 336
                 $field = Parser::$KEYWORD_PARSERS[$token_value]['field'];
337
-                if (! empty(Parser::$KEYWORD_PARSERS[$token_value]['options'])) {
337
+                if (!empty(Parser::$KEYWORD_PARSERS[$token_value]['options'])) {
338 338
                     $options = Parser::$KEYWORD_PARSERS[$token_value]['options'];
339 339
                 }
340 340
             }
341 341
 
342 342
             // Checking if this is the beginning of the statement.
343
-            if (! empty(Parser::$STATEMENT_PARSERS[$token->keyword])) {
344
-                if (! empty(static::$CLAUSES) // Undefined for some statements.
343
+            if (!empty(Parser::$STATEMENT_PARSERS[$token->keyword])) {
344
+                if (!empty(static::$CLAUSES) // Undefined for some statements.
345 345
                     && empty(static::$CLAUSES[$token->value])
346 346
                 ) {
347 347
                     // Some keywords (e.g. `SET`) may be the beginning of a
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                     break;
357 357
                 }
358 358
 
359
-                if (! $parsedOptions) {
359
+                if (!$parsedOptions) {
360 360
                     if (empty(static::$OPTIONS[$token->value])) {
361 361
                         // Skipping keyword because if it is not a option.
362 362
                         ++$list->idx;
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
                 if ($minJoin === 0 && stripos($clauseType, 'JOIN')) {
540 540
                     // First JOIN clause is detected
541 541
                     $minJoin = $maxJoin = $clauseStartIdx;
542
-                } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) {
542
+                } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) {
543 543
                     // After a previous JOIN clause, a non-JOIN clause has been detected
544 544
                     $maxJoin = $lastIdx;
545 545
                 } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) {
Please login to merge, or discard this patch.
src/Components/GroupKeyword.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
                 } elseif (($token->type === Token::TYPE_OPERATOR)
100 100
                     && ($token->value === ',')
101 101
                 ) {
102
-                    if (! empty($expr->expr)) {
102
+                    if (!empty($expr->expr)) {
103 103
                         $ret[] = $expr;
104 104
                     }
105 105
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         // Last iteration was not processed.
115
-        if (! empty($expr->expr)) {
115
+        if (!empty($expr->expr)) {
116 116
             $ret[] = $expr;
117 117
         }
118 118
 
Please login to merge, or discard this patch.
src/Components/AlterOperation.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
                     } elseif (($token->value === ',') && ($brackets === 0)) {
279 279
                         break;
280 280
                     }
281
-                } elseif (! self::checkIfTokenQuotedSymbol($token)) {
282
-                    if (! empty(Parser::$STATEMENT_PARSERS[$token->value])) {
281
+                } elseif (!self::checkIfTokenQuotedSymbol($token)) {
282
+                    if (!empty(Parser::$STATEMENT_PARSERS[$token->value])) {
283 283
                         // We have reached the end of ALTER operation and suddenly found
284 284
                         // a start to new statement, but have not find a delimiter between them
285 285
 
286
-                        if (! ($token->value === 'SET' && $list->tokens[$list->idx - 1]->value === 'CHARACTER')) {
286
+                        if (!($token->value === 'SET' && $list->tokens[$list->idx - 1]->value === 'CHARACTER')) {
287 287
                             $parser->error(
288 288
                                 'A new statement was found, but no delimiter between it and the previous one.',
289 289
                                 $token
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                         }
293 293
                     } elseif ((array_key_exists($array_key, self::$DB_OPTIONS)
294 294
                         || array_key_exists($array_key, self::$TABLE_OPTIONS))
295
-                        && ! self::checkIfColumnDefinitionKeyword($array_key)
295
+                        && !self::checkIfColumnDefinitionKeyword($array_key)
296 296
                     ) {
297 297
                         // This alter operation has finished, which means a comma
298 298
                         // was missing before start of new alter operation
Please login to merge, or discard this patch.
src/Utils/Tokens.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
         // Flags.
59
-        return ! isset($pattern['flags'])
60
-            || (! (($pattern['flags'] & $token->flags) === 0));
59
+        return !isset($pattern['flags'])
60
+            || (!(($pattern['flags'] & $token->flags) === 0));
61 61
     }
62 62
 
63 63
     /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $isList = $list instanceof TokensList;
76 76
 
77 77
         // Parsing the tokens.
78
-        if (! $isList) {
78
+        if (!$isList) {
79 79
             $list = Lexer::getTokens($list);
80 80
         }
81 81
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                     ++$j;
136 136
                 }
137 137
 
138
-                if (! static::match($list->tokens[$j], $find[$k])) {
138
+                if (!static::match($list->tokens[$j], $find[$k])) {
139 139
                     // This token does not match the pattern.
140 140
                     break;
141 141
                 }
Please login to merge, or discard this patch.
src/Lexer.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use function strlen;
21 21
 use function substr;
22 22
 
23
-if (! defined('USE_UTF_STRINGS')) {
23
+if (!defined('USE_UTF_STRINGS')) {
24 24
     // NOTE: In previous versions of PHP (5.5 and older) the default
25 25
     // internal encoding is "ISO-8859-1".
26 26
     // All `mb_` functions must specify the correct encoding, which is
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
         // For multi-byte strings, a new instance of `UtfString` is
177 177
         // initialized (only if `UtfString` usage is forced.
178
-        if (! $str instanceof UtfString && USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) {
178
+        if (!$str instanceof UtfString && USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) {
179 179
             $str = new UtfString($str);
180 180
         }
181 181
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         // Setting the delimiter.
188 188
         $this->setDelimiter(
189
-            ! empty($delimiter) ? $delimiter : static::$DEFAULT_DELIMITER
189
+            !empty($delimiter) ? $delimiter : static::$DEFAULT_DELIMITER
190 190
         );
191 191
 
192 192
         $this->lex();
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
                 $this->delimiter = null;
321 321
                 $delimiterLen = 0;
322 322
                 while (++$this->last < $this->len
323
-                    && ! Context::isWhitespace($this->str[$this->last])
323
+                    && !Context::isWhitespace($this->str[$this->last])
324 324
                     && $delimiterLen < 15
325 325
                 ) {
326 326
                     $this->delimiter .= $this->str[$this->last];
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
     {
567 567
         $token = $this->str[$this->last];
568 568
 
569
-        if (! Context::isWhitespace($token)) {
569
+        if (!Context::isWhitespace($token)) {
570 570
             return null;
571 571
         }
572 572
 
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
                 }
807 807
             } elseif ($state === 2) {
808 808
                 $flags |= Token::FLAG_NUMBER_HEX;
809
-                if (! (
809
+                if (!(
810 810
                         ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9')
811 811
                         || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F')
812 812
                         || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f')
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
         $token = $this->str[$this->last];
908 908
         $flags = Context::isString($token);
909 909
 
910
-        if (! $flags && $token !== $quote) {
910
+        if (!$flags && $token !== $quote) {
911 911
             return null;
912 912
         }
913 913
 
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
         $token = $this->str[$this->last];
959 959
         $flags = Context::isSymbol($token);
960 960
 
961
-        if (! $flags) {
961
+        if (!$flags) {
962 962
             return null;
963 963
         }
964 964
 
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
             return null;
1014 1014
         }
1015 1015
 
1016
-        while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) {
1016
+        while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) {
1017 1017
             $token .= $this->str[$this->last];
1018 1018
 
1019 1019
             // Test if end of token equals the current delimiter. If so, remove it from the token.
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 = [], $count = -1)
46 46
     {
47
-        if (! empty($tokens)) {
47
+        if (!empty($tokens)) {
48 48
             $this->tokens = $tokens;
49 49
             $this->count = $count === -1 ? count($tokens) : $count;
50 50
         }
Please login to merge, or discard this patch.