Passed
Pull Request — master (#521)
by
unknown
04:59
created
tests/Tools/ContextGeneratorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
         $this->assertEquals([
44 44
             TokenType::Keyword->value | Token::FLAG_KEYWORD_RESERVED => [
45 45
                 8 => ['RESERVED'],
46
-                9 => ['RESERVED2','RESERVED3','RESERVED4','RESERVED5'],
46
+                9 => ['RESERVED2', 'RESERVED3', 'RESERVED4', 'RESERVED5'],
47 47
             ],
48 48
             TokenType::Keyword->value | Token::FLAG_KEYWORD_FUNCTION => [8 => ['FUNCTION']],
49 49
             TokenType::Keyword->value | Token::FLAG_KEYWORD_DATA_TYPE => [8 => ['DATATYPE']],
Please login to merge, or discard this patch.
src/Token.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         switch ($this->type) {
129 129
             case TokenType::Keyword:
130 130
                 $this->keyword = strtoupper($this->token);
131
-                if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) {
131
+                if (!($this->flags & self::FLAG_KEYWORD_RESERVED)) {
132 132
                     // Unreserved keywords should stay the way they are because they
133 133
                     // might represent field names.
134 134
                     return $this->token;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                     }
154 154
                 } elseif (($this->flags & self::FLAG_NUMBER_APPROXIMATE) || ($this->flags & self::FLAG_NUMBER_FLOAT)) {
155 155
                     $ret = (float) $ret;
156
-                } elseif (! ($this->flags & self::FLAG_NUMBER_BINARY)) {
156
+                } elseif (!($this->flags & self::FLAG_NUMBER_BINARY)) {
157 157
                     $ret = (int) $ret;
158 158
                 }
159 159
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                     // in PHP 5.3- the `null` parameter isn't handled correctly.
189 189
                     $str = mb_substr(
190 190
                         $str,
191
-                        ! empty($str[1]) && ($str[1] === '@') ? 2 : 1,
191
+                        !empty($str[1]) && ($str[1] === '@') ? 2 : 1,
192 192
                         mb_strlen($str),
193 193
                         'UTF-8'
194 194
                     );
Please login to merge, or discard this patch.
src/Components/CaseExpression.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
                 // Handle optional AS keyword before alias
201 201
                 if ($token->type === TokenType::Keyword && $token->keyword === 'AS') {
202
-                    if ($asFound || ! empty($ret->alias)) {
202
+                    if ($asFound || !empty($ret->alias)) {
203 203
                         $parser->error('Potential duplicate alias of CASE expression.', $token);
204 204
                         break;
205 205
                     }
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
                 if (
222 222
                     $asFound
223 223
                     || $token->type === TokenType::String
224
-                    || ($token->type === TokenType::Symbol && ! $token->flags & Token::FLAG_SYMBOL_VARIABLE)
224
+                    || ($token->type === TokenType::Symbol && !$token->flags & Token::FLAG_SYMBOL_VARIABLE)
225 225
                     || $token->type === TokenType::None
226 226
                 ) {
227 227
                     // An alias is expected (the keyword `AS` was previously found).
228
-                    if (! empty($ret->alias)) {
228
+                    if (!empty($ret->alias)) {
229 229
                         $parser->error('An alias was previously found.', $token);
230 230
                         break;
231 231
                     }
Please login to merge, or discard this patch.
src/Statements/CreateStatement.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      *
270 270
      * Used by all `CREATE` statements.
271 271
      */
272
-    public Expression|null $name = null;
272
+    public Expression | null $name = null;
273 273
 
274 274
     /**
275 275
      * The options of the entity (table, procedure, function, etc.).
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
     public function build(): string
399 399
     {
400 400
         $fields = '';
401
-        if (! empty($this->fields)) {
401
+        if (!empty($this->fields)) {
402 402
             if (is_array($this->fields)) {
403 403
                 $fields = CreateDefinition::buildAll($this->fields) . ' ';
404 404
             } elseif ($this->fields instanceof ArrayObj) {
@@ -437,23 +437,23 @@  discard block
 block discarded – undo
437 437
 
438 438
             $partition = '';
439 439
 
440
-            if (! empty($this->partitionBy)) {
440
+            if (!empty($this->partitionBy)) {
441 441
                 $partition .= "\nPARTITION BY " . $this->partitionBy;
442 442
             }
443 443
 
444
-            if (! empty($this->partitionsNum)) {
444
+            if (!empty($this->partitionsNum)) {
445 445
                 $partition .= "\nPARTITIONS " . $this->partitionsNum;
446 446
             }
447 447
 
448
-            if (! empty($this->subpartitionBy)) {
448
+            if (!empty($this->subpartitionBy)) {
449 449
                 $partition .= "\nSUBPARTITION BY " . $this->subpartitionBy;
450 450
             }
451 451
 
452
-            if (! empty($this->subpartitionsNum)) {
452
+            if (!empty($this->subpartitionsNum)) {
453 453
                 $partition .= "\nSUBPARTITIONS " . $this->subpartitionsNum;
454 454
             }
455 455
 
456
-            if (! empty($this->partitions)) {
456
+            if (!empty($this->partitions)) {
457 457
                 $partition .= "\n" . PartitionDefinition::buildAll($this->partitions);
458 458
             }
459 459
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
                         $token = $list->getNextOfType(TokenType::Number);
648 648
                         --$list->idx; // `getNextOfType` also advances one position.
649 649
                         $this->subpartitionsNum = $token->value;
650
-                    } elseif (! empty($field)) {
650
+                    } elseif (!empty($field)) {
651 651
                         /*
652 652
                          * Handling the content of `PARTITION BY` and `SUBPARTITION BY`.
653 653
                          */
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
                             $field = null;
677 677
                         }
678 678
                     } elseif (($token->type === TokenType::Operator) && ($token->value === '(')) {
679
-                        if (! empty($this->partitionBy)) {
679
+                        if (!empty($this->partitionBy)) {
680 680
                             $this->partitions = ArrayObj::parse(
681 681
                                 $parser,
682 682
                                 $list,
Please login to merge, or discard this patch.
src/UtfString.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $this->str = $str;
80 80
         $this->byteLen = mb_strlen($str, '8bit');
81
-        if (! mb_check_encoding($str, 'UTF-8')) {
81
+        if (!mb_check_encoding($str, 'UTF-8')) {
82 82
             $this->charLen = 0;
83 83
         } else {
84 84
             $this->charLen = mb_strlen($str, 'UTF-8');
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @param int $offset the offset to be returned
102 102
      */
103
-    public function offsetGet(mixed $offset): string|null
103
+    public function offsetGet(mixed $offset): string | null
104 104
     {
105 105
         // This function moves the internal byte and character pointer to the requested offset.
106 106
         // This function is part of hot code so the aim is to do the following
Please login to merge, or discard this patch.
src/Exceptions/ParserException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      * @param Token  $token the token that produced this exception
25 25
      * @param int    $code  the code of this error
26 26
      */
27
-    public function __construct(string $msg = '', Token|null $token = null, int $code = 0)
27
+    public function __construct(string $msg = '', Token | null $token = null, int $code = 0)
28 28
     {
29 29
         parent::__construct($msg, $code);
30 30
         $this->token = $token;
Please login to merge, or discard this patch.
src/Utils/Formatter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
                 // The options of a clause should stay on the same line and everything that follows.
436 436
                 if (
437 437
                     $this->options['parts_newline']
438
-                    && ! $formattedOptions
438
+                    && !$formattedOptions
439 439
                     && empty(self::$inlineClauses[$lastClause])
440 440
                     && (
441 441
                         $curr->type !== TokenType::Keyword
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                         end($blocksLineEndings) === true
493 493
                         || (
494 494
                             empty(self::$inlineClauses[$lastClause])
495
-                            && ! $shortGroup
495
+                            && !$shortGroup
496 496
                             && $this->options['parts_newline']
497 497
                         )
498 498
                     ) {
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                     $lineEnded = false;
529 529
                 } elseif (
530 530
                     $prev->keyword === 'DELIMITER'
531
-                    || ! (
531
+                    || !(
532 532
                     ($prev->type === TokenType::Operator && ($prev->value === '.' || $prev->value === '('))
533 533
                     // No space after . (
534 534
                     || ($curr->type === TokenType::Operator
@@ -643,13 +643,13 @@  discard block
 block discarded – undo
643 643
 
644 644
         foreach ($this->options['formats'] as $format) {
645 645
             if (
646
-                $token->type->value !== $format['type'] || ! (($token->flags & $format['flags']) === $format['flags'])
646
+                $token->type->value !== $format['type'] || !(($token->flags & $format['flags']) === $format['flags'])
647 647
             ) {
648 648
                 continue;
649 649
             }
650 650
 
651 651
             // Running transformation function.
652
-            if (! empty($format['function'])) {
652
+            if (!empty($format['function'])) {
653 653
                 $func = $format['function'];
654 654
                 $text = $func($text);
655 655
             }
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      *
759 759
      * @psalm-return 1|2|false
760 760
      */
761
-    public static function isClause(Token $token): int|false
761
+    public static function isClause(Token $token): int | false
762 762
     {
763 763
         if (
764 764
             ($token->type === TokenType::Keyword && isset(Parser::STATEMENT_PARSERS[$token->keyword]))
Please login to merge, or discard this patch.
src/Utils/BufferedQuery.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      *
120 120
      * @param bool $end whether the end of the buffer was reached
121 121
      */
122
-    public function extract(bool $end = false): string|false
122
+    public function extract(bool $end = false): string | false
123 123
     {
124 124
         /**
125 125
          * The last parsed position.
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 
312 312
                 // Parsing the delimiter.
313 313
                 $delimiter = '';
314
-                while (($i < $len) && (! Context::isWhitespace($this->query[$i]))) {
314
+                while (($i < $len) && (!Context::isWhitespace($this->query[$i]))) {
315 315
                     $delimiter .= $this->query[$i++];
316 316
                 }
317 317
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
                     // Whether this statement should be returned or not.
328 328
                     $ret = '';
329
-                    if (! empty($this->options['parse_delimiter'])) {
329
+                    if (!empty($this->options['parse_delimiter'])) {
330 330
                         // Appending the `DELIMITER` statement that was just
331 331
                         // found to the current statement.
332 332
                         $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/Utils/CLI.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         foreach ($longopts as $value) {
38 38
             $value = rtrim($value, ':');
39
-            if (! isset($params[$value])) {
39
+            if (!isset($params[$value])) {
40 40
                 continue;
41 41
             }
42 42
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return string[]|false[]|false
57 57
      */
58
-    public function getopt(string $opt, array $long): array|false
58
+    public function getopt(string $opt, array $long): array | false
59 59
     {
60 60
         return getopt($opt, $long);
61 61
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     /**
64 64
      * @return string[]|false[]|false
65 65
      */
66
-    public function parseHighlight(): array|false
66
+    public function parseHighlight(): array | false
67 67
     {
68 68
         $longopts = [
69 69
             'help',
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         $this->mergeLongOpts($params, $longopts);
80
-        if (! isset($params['f'])) {
80
+        if (!isset($params['f'])) {
81 81
             $params['f'] = 'cli';
82 82
         }
83 83
 
84
-        if (! in_array($params['f'], ['html', 'cli', 'text'])) {
84
+        if (!in_array($params['f'], ['html', 'cli', 'text'])) {
85 85
             echo "ERROR: Invalid value for format!\n";
86 86
 
87 87
             return false;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             return 0;
104 104
         }
105 105
 
106
-        if (! isset($params['q'])) {
106
+        if (!isset($params['q'])) {
107 107
             $stdIn = $this->readStdin();
108 108
 
109 109
             if ($stdIn) {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     /**
141 141
      * @return string[]|false[]|false
142 142
      */
143
-    public function parseLint(): array|false
143
+    public function parseLint(): array | false
144 144
     {
145 145
         $longopts = [
146 146
             'help',
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             Context::load($params['c']);
172 172
         }
173 173
 
174
-        if (! isset($params['q'])) {
174
+        if (!isset($params['q'])) {
175 175
             $stdIn = $this->readStdin();
176 176
 
177 177
             if ($stdIn) {
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     /**
214 214
      * @return string[]|false[]|false
215 215
      */
216
-    public function parseTokenize(): array|false
216
+    public function parseTokenize(): array | false
217 217
     {
218 218
         $longopts = [
219 219
             'help',
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             return 0;
240 240
         }
241 241
 
242
-        if (! isset($params['q'])) {
242
+        if (!isset($params['q'])) {
243 243
             $stdIn = $this->readStdin();
244 244
 
245 245
             if ($stdIn) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         return 1;
276 276
     }
277 277
 
278
-    public function readStdin(): string|false|null
278
+    public function readStdin(): string | false | null
279 279
     {
280 280
         $read = [STDIN];
281 281
         $write = [];
Please login to merge, or discard this patch.