Passed
Pull Request — master (#465)
by
unknown
03:00
created
src/UtfString.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         $this->byteIdx = 0;
191 191
         $this->charIdx = 0;
192 192
         $this->byteLen = mb_strlen($str, '8bit');
193
-        if (! mb_check_encoding($str, 'UTF-8')) {
193
+        if (!mb_check_encoding($str, 'UTF-8')) {
194 194
             $this->charLen = 0;
195 195
         } else {
196 196
             $this->charLen = mb_strlen($str, 'UTF-8');
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         // Use the default ASCII map as queries are mostly ASCII chars
299 299
         // ord($byte) has a performance cost
300 300
 
301
-        if (! isset(static::$asciiMap[$byte])) {
301
+        if (!isset(static::$asciiMap[$byte])) {
302 302
             // Complete the cache with missing items
303 303
             static::$asciiMap[$byte] = ord($byte);
304 304
         }
Please login to merge, or discard this patch.
tests/Tools/ContextGeneratorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
         $this->assertEquals([
43 43
             Token::TYPE_KEYWORD | Token::FLAG_KEYWORD_RESERVED => [
44 44
                 8 => ['RESERVED'],
45
-                9 => ['RESERVED2','RESERVED3','RESERVED4','RESERVED5'],
45
+                9 => ['RESERVED2', 'RESERVED3', 'RESERVED4', 'RESERVED5'],
46 46
             ],
47 47
             Token::TYPE_KEYWORD | Token::FLAG_KEYWORD_FUNCTION => [8 => ['FUNCTION']],
48 48
             Token::TYPE_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE => [8 => ['DATATYPE']],
Please login to merge, or discard this patch.
tests/benchmarks/UtfStringBench.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     {
27 27
         $str1 = new UtfString($this->testContents);
28 28
         for ($i = 0; $i < $str1->length(); $i++) {
29
-            $str1[$i];// Make offset offsetGet work
29
+            $str1[$i]; // Make offset offsetGet work
30 30
         }
31 31
     }
32 32
 
Please login to merge, or discard this patch.
tests/Parser/ParserLongExportsTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         foreach ($parser->statements as $statement) {
65 65
             if ($statement instanceof TransactionStatement) {
66 66
                 foreach ($statement->statements as $transactionStatement) {
67
-                    if (! $transactionStatement instanceof SetStatement) {
67
+                    if (!$transactionStatement instanceof SetStatement) {
68 68
                         continue;
69 69
                     }
70 70
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 continue;
75 75
             }
76 76
 
77
-            if (! $statement instanceof SetStatement) {
77
+            if (!$statement instanceof SetStatement) {
78 78
                 continue;
79 79
             }
80 80
 
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
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         // The code below extracts only the relevant information.
84 84
 
85 85
         // Extracting lexer's errors.
86
-        if (! empty($lexer->errors)) {
86
+        if (!empty($lexer->errors)) {
87 87
             /** @var LexerException $err */
88 88
             foreach ($lexer->errors as $err) {
89 89
                 $lexerErrors[] = [
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         }
99 99
 
100 100
         // Extracting parser's errors.
101
-        if (! empty($parser->errors)) {
101
+        if (!empty($parser->errors)) {
102 102
             /** @var ParserException $err */
103 103
             foreach ($parser->errors as $err) {
104 104
                 $parserErrors[] = [
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     public static function build($type, $input, $output, $debug = null, $ansi = false)
139 139
     {
140 140
         // Support query types: `lexer` / `parser`.
141
-        if (! in_array($type, ['lexer', 'parser'])) {
141
+        if (!in_array($type, ['lexer', 'parser'])) {
142 142
             throw new Exception('Unknown test type (expected `lexer` or `parser`).');
143 143
         }
144 144
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         );
184 184
 
185 185
         // Remove the project path from .out file, it changes for each dev
186
-        $projectFolder = dirname(__DIR__, 2);// Jump to root
186
+        $projectFolder = dirname(__DIR__, 2); // Jump to root
187 187
         $encoded = str_replace($projectFolder, '<project-root>', $encoded);
188 188
 
189 189
         file_put_contents($output, $encoded);
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
             if (is_dir($inputFile)) {
224 224
                 // Creating required directories to maintain the structure.
225 225
                 // Ignoring errors if the folder structure exists already.
226
-                if (! is_dir($outputFile)) {
226
+                if (!is_dir($outputFile)) {
227 227
                     mkdir($outputFile);
228 228
                 }
229 229
 
230
-                if (($debug !== null) && (! is_dir($debugFile))) {
230
+                if (($debug !== null) && (!is_dir($debugFile))) {
231 231
                     mkdir($debugFile);
232 232
                 }
233 233
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                 }
243 243
 
244 244
                 // Building the test.
245
-                if (! file_exists($outputFile)) {
245
+                if (!file_exists($outputFile)) {
246 246
                     echo sprintf("Building test for %s...\n", $inputFile);
247 247
                     static::build(
248 248
                         str_contains($inputFile, 'lex') ? 'lexer' : 'parser',
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
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
      */
68 68
     public static function gettext($msgid)
69 69
     {
70
-        if (! class_exists(Loader::class, true)) {
70
+        if (!class_exists(Loader::class, true)) {
71 71
             return $msgid;
72 72
         }
73 73
 
Please login to merge, or discard this patch.
src/Lexer.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use function strlen;
16 16
 use function substr;
17 17
 
18
-if (! defined('USE_UTF_STRINGS')) {
18
+if (!defined('USE_UTF_STRINGS')) {
19 19
     // NOTE: In previous versions of PHP (5.5 and older) the default
20 20
     // internal encoding is "ISO-8859-1".
21 21
     // All `mb_` functions must specify the correct encoding, which is
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
         // For multi-byte strings, a new instance of `UtfString` is
203 203
         // initialized (only if `UtfString` usage is forced.
204
-        if (! $str instanceof UtfString && USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) {
204
+        if (!$str instanceof UtfString && USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) {
205 205
             $str = new UtfString($str);
206 206
         }
207 207
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $this->strict = $strict;
212 212
 
213 213
         // Setting the delimiter.
214
-        $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter);
214
+        $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter);
215 215
 
216 216
         $this->lex();
217 217
     }
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
                 $delimiterLen = 0;
340 340
                 while (
341 341
                     ++$this->last < $this->len
342
-                    && ! Context::isWhitespace($this->str[$this->last])
342
+                    && !Context::isWhitespace($this->str[$this->last])
343 343
                     && $delimiterLen < 15
344 344
                 ) {
345 345
                     $this->delimiter .= $this->str[$this->last];
@@ -398,8 +398,8 @@  discard block
 block discarded – undo
398 398
             }
399 399
 
400 400
             if (
401
-                ($next->type !== Token::TYPE_KEYWORD || ! in_array($next->value, ['FROM', 'USING'], true))
402
-                && ($next->type !== Token::TYPE_OPERATOR || ! in_array($next->value, [',', ')'], true))
401
+                ($next->type !== Token::TYPE_KEYWORD || !in_array($next->value, ['FROM', 'USING'], true))
402
+                && ($next->type !== Token::TYPE_OPERATOR || !in_array($next->value, [',', ')'], true))
403 403
             ) {
404 404
                 continue;
405 405
             }
@@ -437,10 +437,10 @@  discard block
 block discarded – undo
437 437
             $next = $this->list->getNext();
438 438
             if (
439 439
                 ($next->type !== Token::TYPE_KEYWORD
440
-                    || ! in_array($next->value, $this->keywordNameIndicators, true)
440
+                    || !in_array($next->value, $this->keywordNameIndicators, true)
441 441
                 )
442 442
                 && ($next->type !== Token::TYPE_OPERATOR
443
-                    || ! in_array($next->value, $this->operatorNameIndicators, true)
443
+                    || !in_array($next->value, $this->operatorNameIndicators, true)
444 444
                 )
445 445
                 && ($next->value !== null)
446 446
             ) {
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
             $token .= $this->str[$this->last];
524 524
             $flags = Context::isKeyword($token);
525 525
 
526
-            if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) {
526
+            if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) {
527 527
                 continue;
528 528
             }
529 529
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
             $token .= $this->str[$this->last];
612 612
             $flags = Context::isOperator($token);
613 613
 
614
-            if (! $flags) {
614
+            if (!$flags) {
615 615
                 continue;
616 616
             }
617 617
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
     {
634 634
         $token = $this->str[$this->last];
635 635
 
636
-        if (! Context::isWhitespace($token)) {
636
+        if (!Context::isWhitespace($token)) {
637 637
             return null;
638 638
         }
639 639
 
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
             } elseif ($state === 2) {
874 874
                 $flags |= Token::FLAG_NUMBER_HEX;
875 875
                 if (
876
-                    ! (
876
+                    !(
877 877
                         ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9')
878 878
                         || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F')
879 879
                         || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f')
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
         $token = $this->str[$this->last];
977 977
         $flags = Context::isString($token);
978 978
 
979
-        if (! $flags && $token !== $quote) {
979
+        if (!$flags && $token !== $quote) {
980 980
             return null;
981 981
         }
982 982
 
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
         $token = $this->str[$this->last];
1029 1029
         $flags = Context::isSymbol($token);
1030 1030
 
1031
-        if (! $flags) {
1031
+        if (!$flags) {
1032 1032
             return null;
1033 1033
         }
1034 1034
 
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
             return null;
1080 1080
         }
1081 1081
 
1082
-        while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) {
1082
+        while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) {
1083 1083
             $token .= $this->str[$this->last];
1084 1084
 
1085 1085
             // 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/Statements/SelectStatement.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -349,7 +349,7 @@
 block discarded – undo
349 349
         // This is a cheap fix for `SELECT` statements that contain `UNION`.
350 350
         // The `ORDER BY` and `LIMIT` clauses should be at the end of the
351 351
         // statement.
352
-        if (! empty($this->union)) {
352
+        if (!empty($this->union)) {
353 353
             $clauses = static::$clauses;
354 354
             unset($clauses['ORDER BY'], $clauses['LIMIT']);
355 355
             $clauses['ORDER BY'] = [
Please login to merge, or discard this patch.
src/Utils/Query.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         $flags['querytype'] = 'SELECT';
293 293
         $flags['is_select'] = true;
294 294
 
295
-        if (! empty($statement->from)) {
295
+        if (!empty($statement->from)) {
296 296
             $flags['select_from'] = true;
297 297
         }
298 298
 
@@ -300,23 +300,23 @@  discard block
 block discarded – undo
300 300
             $flags['distinct'] = true;
301 301
         }
302 302
 
303
-        if (! empty($statement->group) || ! empty($statement->having)) {
303
+        if (!empty($statement->group) || !empty($statement->having)) {
304 304
             $flags['is_group'] = true;
305 305
         }
306 306
 
307
-        if (! empty($statement->into) && ($statement->into->type === 'OUTFILE')) {
307
+        if (!empty($statement->into) && ($statement->into->type === 'OUTFILE')) {
308 308
             $flags['is_export'] = true;
309 309
         }
310 310
 
311 311
         $expressions = $statement->expr;
312
-        if (! empty($statement->join)) {
312
+        if (!empty($statement->join)) {
313 313
             foreach ($statement->join as $join) {
314 314
                 $expressions[] = $join->expr;
315 315
             }
316 316
         }
317 317
 
318 318
         foreach ($expressions as $expr) {
319
-            if (! empty($expr->function)) {
319
+            if (!empty($expr->function)) {
320 320
                 if ($expr->function === 'COUNT') {
321 321
                     $flags['is_count'] = true;
322 322
                 } elseif (in_array($expr->function, static::$functions)) {
@@ -331,23 +331,23 @@  discard block
 block discarded – undo
331 331
             $flags['is_subquery'] = true;
332 332
         }
333 333
 
334
-        if (! empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) {
334
+        if (!empty($statement->procedure) && ($statement->procedure->name === 'ANALYSE')) {
335 335
             $flags['is_analyse'] = true;
336 336
         }
337 337
 
338
-        if (! empty($statement->group)) {
338
+        if (!empty($statement->group)) {
339 339
             $flags['group'] = true;
340 340
         }
341 341
 
342
-        if (! empty($statement->having)) {
342
+        if (!empty($statement->having)) {
343 343
             $flags['having'] = true;
344 344
         }
345 345
 
346
-        if (! empty($statement->union)) {
346
+        if (!empty($statement->union)) {
347 347
             $flags['union'] = true;
348 348
         }
349 349
 
350
-        if (! empty($statement->join)) {
350
+        if (!empty($statement->join)) {
351 351
             $flags['join'] = true;
352 352
         }
353 353
 
@@ -438,11 +438,11 @@  discard block
 block discarded – undo
438 438
             || ($statement instanceof UpdateStatement)
439 439
             || ($statement instanceof DeleteStatement)
440 440
         ) {
441
-            if (! empty($statement->limit)) {
441
+            if (!empty($statement->limit)) {
442 442
                 $flags['limit'] = true;
443 443
             }
444 444
 
445
-            if (! empty($statement->order)) {
445
+            if (!empty($statement->order)) {
446 446
                 $flags['order'] = true;
447 447
             }
448 448
         }
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
             // Finding tables' aliases and their associated real names.
493 493
             $tableAliases = [];
494 494
             foreach ($statement->from as $expr) {
495
-                if (! isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) {
495
+                if (!isset($expr->table, $expr->alias) || ($expr->table === '') || ($expr->alias === '')) {
496 496
                     continue;
497 497
                 }
498 498
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                         ];
518 518
                     }
519 519
 
520
-                    if (! in_array($arr, $ret['select_tables'])) {
520
+                    if (!in_array($arr, $ret['select_tables'])) {
521 521
                         $ret['select_tables'][] = $arr;
522 522
                     }
523 523
                 } else {
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
             // extracted from the FROM clause.
531 531
             if (empty($ret['select_tables'])) {
532 532
                 foreach ($statement->from as $expr) {
533
-                    if (! isset($expr->table) || ($expr->table === '')) {
533
+                    if (!isset($expr->table) || ($expr->table === '')) {
534 534
                         continue;
535 535
                     }
536 536
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
         } elseif (($statement instanceof AlterStatement) || ($statement instanceof TruncateStatement)) {
572 572
             $expressions = [$statement->table];
573 573
         } elseif ($statement instanceof DropStatement) {
574
-            if (! $statement->options->has('TABLE')) {
574
+            if (!$statement->options->has('TABLE')) {
575 575
                 // No tables are dropped.
576 576
                 return [];
577 577
             }
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 
852 852
             $statement .= $token->token;
853 853
 
854
-            if (($token->type === Token::TYPE_DELIMITER) && ! empty($token->token)) {
854
+            if (($token->type === Token::TYPE_DELIMITER) && !empty($token->token)) {
855 855
                 $delimiter = $token->token;
856 856
                 $fullStatement = true;
857 857
                 break;
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 
861 861
         // No statement was found so we return the entire query as being the
862 862
         // remaining part.
863
-        if (! $fullStatement) {
863
+        if (!$fullStatement) {
864 864
             return [
865 865
                 null,
866 866
                 $query,
Please login to merge, or discard this patch.