Passed
Push — master ( 26b7be...6fd2c5 )
by Maurício
05:21 queued 02:34
created
tests/Misc/UtfStringTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
      * Test access to string.
87 87
      */
88 88
     #[DataProvider('utf8StringsProvider')]
89
-    public function testAccess(string $text, string|null $pos10, string|null $pos20): void
89
+    public function testAccess(string $text, string | null $pos10, string | null $pos20): void
90 90
     {
91 91
         $str = new UtfString($text);
92 92
         $this->assertEquals($pos10, $str->offsetGet(10));
Please login to merge, or discard this patch.
src/UtfString.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     {
189 189
         $this->str = $str;
190 190
         $this->byteLen = mb_strlen($str, '8bit');
191
-        if (! mb_check_encoding($str, 'UTF-8')) {
191
+        if (!mb_check_encoding($str, 'UTF-8')) {
192 192
             $this->charLen = 0;
193 193
         } else {
194 194
             $this->charLen = mb_strlen($str, 'UTF-8');
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      *
211 211
      * @param int $offset the offset to be returned
212 212
      */
213
-    public function offsetGet($offset): string|null
213
+    public function offsetGet($offset): string | null
214 214
     {
215 215
         if (($offset < 0) || ($offset >= $this->charLen)) {
216 216
             return null;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         // Use the default ASCII map as queries are mostly ASCII chars
287 287
         // ord($byte) has a performance cost
288 288
 
289
-        if (! isset(static::$asciiMap[$byte])) {
289
+        if (!isset(static::$asciiMap[$byte])) {
290 290
             // Complete the cache with missing items
291 291
             static::$asciiMap[$byte] = ord($byte);
292 292
         }
Please login to merge, or discard this patch.
src/Statements/InsertStatement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      *
78 78
      * @var ArrayObj[]|null
79 79
      */
80
-    public array|null $values = null;
80
+    public array | null $values = null;
81 81
 
82 82
     /**
83 83
      * If SET clause is present
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @var SetOperation[]|null
87 87
      */
88
-    public array|null $set = null;
88
+    public array | null $set = null;
89 89
 
90 90
     /**
91 91
      * If SELECT clause is present
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @var SetOperation[]|null
111 111
      */
112
-    public array|null $onDuplicateSet = null;
112
+    public array | null $onDuplicateSet = null;
113 113
 
114 114
     public function build(): string
115 115
     {
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[] = [
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     public static function build($type, $input, $output, $debug = null, $ansi = false): void
137 137
     {
138 138
         // Support query types: `lexer` / `parser`.
139
-        if (! in_array($type, ['lexer', 'parser'])) {
139
+        if (!in_array($type, ['lexer', 'parser'])) {
140 140
             throw new Exception('Unknown test type (expected `lexer` or `parser`).');
141 141
         }
142 142
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         );
182 182
 
183 183
         // Remove the project path from .out file, it changes for each dev
184
-        $projectFolder = dirname(__DIR__, 2);// Jump to root
184
+        $projectFolder = dirname(__DIR__, 2); // Jump to root
185 185
         $encoded = str_replace($projectFolder, '<project-root>', $encoded);
186 186
 
187 187
         file_put_contents($output, $encoded);
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
             if (is_dir($inputFile)) {
220 220
                 // Creating required directories to maintain the structure.
221 221
                 // Ignoring errors if the folder structure exists already.
222
-                if (! is_dir($outputFile)) {
222
+                if (!is_dir($outputFile)) {
223 223
                     mkdir($outputFile);
224 224
                 }
225 225
 
226
-                if (($debug !== null) && (! is_dir($debugFile))) {
226
+                if (($debug !== null) && (!is_dir($debugFile))) {
227 227
                     mkdir($debugFile);
228 228
                 }
229 229
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                 }
239 239
 
240 240
                 // Building the test.
241
-                if (! file_exists($outputFile)) {
241
+                if (!file_exists($outputFile)) {
242 242
                     echo sprintf("Building test for %s...\n", $inputFile);
243 243
                     static::build(
244 244
                         str_contains($inputFile, 'lex') ? 'lexer' : 'parser',
Please login to merge, or discard this patch.
src/Lexer.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         $len = $str instanceof UtfString ? $str->length() : strlen($str);
182 182
 
183 183
         // For multi-byte strings, a new instance of `UtfString` is initialized.
184
-        if (! $str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) {
184
+        if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) {
185 185
             $str = new UtfString($str);
186 186
         }
187 187
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         $this->strict = $strict;
192 192
 
193 193
         // Setting the delimiter.
194
-        $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter);
194
+        $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter);
195 195
 
196 196
         $this->lex();
197 197
     }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                 $delimiterLen = 0;
316 316
                 while (
317 317
                     ++$this->last < $this->len
318
-                    && ! Context::isWhitespace($this->str[$this->last])
318
+                    && !Context::isWhitespace($this->str[$this->last])
319 319
                     && $delimiterLen < 15
320 320
                 ) {
321 321
                     $this->delimiter .= $this->str[$this->last];
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
             }
375 375
 
376 376
             if (
377
-                ($next->type !== Token::TYPE_KEYWORD || ! in_array($next->value, ['FROM', 'USING'], true))
378
-                && ($next->type !== Token::TYPE_OPERATOR || ! in_array($next->value, [',', ')'], true))
377
+                ($next->type !== Token::TYPE_KEYWORD || !in_array($next->value, ['FROM', 'USING'], true))
378
+                && ($next->type !== Token::TYPE_OPERATOR || !in_array($next->value, [',', ')'], true))
379 379
             ) {
380 380
                 continue;
381 381
             }
@@ -413,10 +413,10 @@  discard block
 block discarded – undo
413 413
             $next = $this->list->getNext();
414 414
             if (
415 415
                 ($next->type !== Token::TYPE_KEYWORD
416
-                    || ! in_array($next->value, $this->keywordNameIndicators, true)
416
+                    || !in_array($next->value, $this->keywordNameIndicators, true)
417 417
                 )
418 418
                 && ($next->type !== Token::TYPE_OPERATOR
419
-                    || ! in_array($next->value, $this->operatorNameIndicators, true)
419
+                    || !in_array($next->value, $this->operatorNameIndicators, true)
420 420
                 )
421 421
                 && ($next->value !== null)
422 422
             ) {
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     /**
456 456
      * Parses a keyword.
457 457
      */
458
-    public function parseKeyword(): Token|null
458
+    public function parseKeyword(): Token | null
459 459
     {
460 460
         $token = '';
461 461
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
             $token .= $this->str[$this->last];
496 496
             $flags = Context::isKeyword($token);
497 497
 
498
-            if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) {
498
+            if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) {
499 499
                 continue;
500 500
             }
501 501
 
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
     /**
516 516
      * Parses a label.
517 517
      */
518
-    public function parseLabel(): Token|null
518
+    public function parseLabel(): Token | null
519 519
     {
520 520
         $token = '';
521 521
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
     /**
560 560
      * Parses an operator.
561 561
      */
562
-    public function parseOperator(): Token|null
562
+    public function parseOperator(): Token | null
563 563
     {
564 564
         $token = '';
565 565
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
             $token .= $this->str[$this->last];
580 580
             $flags = Context::isOperator($token);
581 581
 
582
-            if (! $flags) {
582
+            if (!$flags) {
583 583
                 continue;
584 584
             }
585 585
 
@@ -595,11 +595,11 @@  discard block
 block discarded – undo
595 595
     /**
596 596
      * Parses a whitespace.
597 597
      */
598
-    public function parseWhitespace(): Token|null
598
+    public function parseWhitespace(): Token | null
599 599
     {
600 600
         $token = $this->str[$this->last];
601 601
 
602
-        if (! Context::isWhitespace($token)) {
602
+        if (!Context::isWhitespace($token)) {
603 603
             return null;
604 604
         }
605 605
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
     /**
616 616
      * Parses a comment.
617 617
      */
618
-    public function parseComment(): Token|null
618
+    public function parseComment(): Token | null
619 619
     {
620 620
         $iBak = $this->last;
621 621
         $token = $this->str[$this->last];
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
     /**
733 733
      * Parses a boolean.
734 734
      */
735
-    public function parseBool(): Token|null
735
+    public function parseBool(): Token | null
736 736
     {
737 737
         if ($this->last + 3 >= $this->len) {
738 738
             // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
     /**
764 764
      * Parses a number.
765 765
      */
766
-    public function parseNumber(): Token|null
766
+    public function parseNumber(): Token | null
767 767
     {
768 768
         // A rudimentary state machine is being used to parse numbers due to
769 769
         // the various forms of their notation.
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
             } elseif ($state === 2) {
834 834
                 $flags |= Token::FLAG_NUMBER_HEX;
835 835
                 if (
836
-                    ! (
836
+                    !(
837 837
                         ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9')
838 838
                         || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F')
839 839
                         || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f')
@@ -929,12 +929,12 @@  discard block
 block discarded – undo
929 929
      *
930 930
      * @throws LexerException
931 931
      */
932
-    public function parseString($quote = ''): Token|null
932
+    public function parseString($quote = ''): Token | null
933 933
     {
934 934
         $token = $this->str[$this->last];
935 935
         $flags = Context::isString($token);
936 936
 
937
-        if (! $flags && $token !== $quote) {
937
+        if (!$flags && $token !== $quote) {
938 938
             return null;
939 939
         }
940 940
 
@@ -979,12 +979,12 @@  discard block
 block discarded – undo
979 979
      *
980 980
      * @throws LexerException
981 981
      */
982
-    public function parseSymbol(): Token|null
982
+    public function parseSymbol(): Token | null
983 983
     {
984 984
         $token = $this->str[$this->last];
985 985
         $flags = Context::isSymbol($token);
986 986
 
987
-        if (! $flags) {
987
+        if (!$flags) {
988 988
             return null;
989 989
         }
990 990
 
@@ -1026,14 +1026,14 @@  discard block
 block discarded – undo
1026 1026
     /**
1027 1027
      * Parses unknown parts of the query.
1028 1028
      */
1029
-    public function parseUnknown(): Token|null
1029
+    public function parseUnknown(): Token | null
1030 1030
     {
1031 1031
         $token = $this->str[$this->last];
1032 1032
         if (Context::isSeparator($token)) {
1033 1033
             return null;
1034 1034
         }
1035 1035
 
1036
-        while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) {
1036
+        while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) {
1037 1037
             $token .= $this->str[$this->last];
1038 1038
 
1039 1039
             // Test if end of token equals the current delimiter. If so, remove it from the token.
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
     /**
1053 1053
      * Parses the delimiter of the query.
1054 1054
      */
1055
-    public function parseDelimiter(): Token|null
1055
+    public function parseDelimiter(): Token | null
1056 1056
     {
1057 1057
         $idx = 0;
1058 1058
 
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
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      *
122 122
      * @param bool $end whether the end of the buffer was reached
123 123
      */
124
-    public function extract($end = false): string|false
124
+    public function extract($end = false): string | false
125 125
     {
126 126
         /**
127 127
          * The last parsed position.
@@ -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
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
                     // Whether this statement should be returned or not.
330 330
                     $ret = '';
331
-                    if (! empty($this->options['parse_delimiter'])) {
331
+                    if (!empty($this->options['parse_delimiter'])) {
332 332
                         // Appending the `DELIMITER` statement that was just
333 333
                         // found to the current statement.
334 334
                         $ret = trim(
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
                 $ret = $this->current;
372 372
 
373 373
                 // If needed, adds a delimiter at the end of the statement.
374
-                if (! empty($this->options['add_delimiter'])) {
374
+                if (!empty($this->options['add_delimiter'])) {
375 375
                     $ret .= $this->delimiter;
376 376
                 }
377 377
 
Please login to merge, or discard this patch.
src/Utils/Table.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public static function getForeignKeys($statement): array
25 25
     {
26
-        if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) {
26
+        if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) {
27 27
             return [];
28 28
         }
29 29
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
             $columns = [];
38 38
             foreach ($field->key->columns as $column) {
39
-                if (! isset($column['name'])) {
39
+                if (!isset($column['name'])) {
40 40
                     continue;
41 41
                 }
42 42
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 'index_list' => $columns,
49 49
             ];
50 50
 
51
-            if (! empty($field->references)) {
51
+            if (!empty($field->references)) {
52 52
                 $tmp['ref_db_name'] = $field->references->table->database;
53 53
                 $tmp['ref_table_name'] = $field->references->table->table;
54 54
                 $tmp['ref_index_list'] = $field->references->columns;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public static function getFields($statement): array
83 83
     {
84
-        if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) {
84
+        if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) {
85 85
             return [];
86 86
         }
87 87
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                 'timestamp_not_null' => false,
99 99
             ];
100 100
 
101
-            if (! $field->options) {
101
+            if (!$field->options) {
102 102
                 continue;
103 103
             }
104 104
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
             $option = $field->options->has('AS');
127 127
 
128
-            if (! $option) {
128
+            if (!$option) {
129 129
                 continue;
130 130
             }
131 131
 
Please login to merge, or discard this patch.
src/TokensList.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * Gets the next token. Skips any irrelevant token (whitespaces and
95 95
      * comments).
96 96
      */
97
-    public function getNext(): Token|null
97
+    public function getNext(): Token | null
98 98
     {
99 99
         for (; $this->idx < $this->count; ++$this->idx) {
100 100
             if (
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * Gets the previous token. Skips any irrelevant token (whitespaces and
113 113
      * comments).
114 114
      */
115
-    public function getPrevious(): Token|null
115
+    public function getPrevious(): Token | null
116 116
     {
117 117
         for (; $this->idx >= 0; --$this->idx) {
118 118
             if (
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
      *
132 132
      * @param int|int[] $type the type
133 133
      */
134
-    public function getPreviousOfType($type): Token|null
134
+    public function getPreviousOfType($type): Token | null
135 135
     {
136
-        if (! is_array($type)) {
136
+        if (!is_array($type)) {
137 137
             $type = [$type];
138 138
         }
139 139
 
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
      *
152 152
      * @param int|int[] $type the type
153 153
      */
154
-    public function getNextOfType($type): Token|null
154
+    public function getNextOfType($type): Token | null
155 155
     {
156
-        if (! is_array($type)) {
156
+        if (!is_array($type)) {
157 157
             $type = [$type];
158 158
         }
159 159
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * @param int    $type  the type of the token
173 173
      * @param string $value the value of the token
174 174
      */
175
-    public function getNextOfTypeAndValue($type, $value): Token|null
175
+    public function getNextOfTypeAndValue($type, $value): Token | null
176 176
     {
177 177
         for (; $this->idx < $this->count; ++$this->idx) {
178 178
             if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->value === $value)) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      * @param int $type the type of the token
190 190
      * @param int $flag the flag of the token
191 191
      */
192
-    public function getNextOfTypeAndFlag(int $type, int $flag): Token|null
192
+    public function getNextOfTypeAndFlag(int $type, int $flag): Token | null
193 193
     {
194 194
         for (; $this->idx < $this->count; ++$this->idx) {
195 195
             if (($this->tokens[$this->idx]->type === $type) && ($this->tokens[$this->idx]->flags === $flag)) {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      *
221 221
      * @param int $offset the offset to be returned
222 222
      */
223
-    public function offsetGet($offset): Token|null
223
+    public function offsetGet($offset): Token | null
224 224
     {
225 225
         return $offset < $this->count ? $this->tokens[$offset] : null;
226 226
     }
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
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
      */
66 66
     public static function gettext($msgid): string
67 67
     {
68
-        if (! class_exists(Loader::class, true)) {
68
+        if (!class_exists(Loader::class, true)) {
69 69
             return $msgid;
70 70
         }
71 71
 
Please login to merge, or discard this patch.