Passed
Pull Request — master (#529)
by
unknown
02:49
created
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
 
Please login to merge, or discard this patch.
src/Components/DataType.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
      * @param OptionsArray   $options    the options of this data type
79 79
      */
80 80
     public function __construct(
81
-        string|null $name = null,
81
+        string | null $name = null,
82 82
         array $parameters = [],
83
-        OptionsArray|null $options = null,
83
+        OptionsArray | null $options = null,
84 84
     ) {
85 85
         $this->name = $name;
86 86
         $this->parameters = $parameters;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @param TokensList           $list    the list of tokens that are being parsed
93 93
      * @param array<string, mixed> $options parameters for parsing
94 94
      */
95
-    public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null
95
+    public static function parse(Parser $parser, TokensList $list, array $options = []): DataType | null
96 96
     {
97 97
         $ret = new static();
98 98
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
             if ($state === 0) {
124 124
                 $ret->name = strtoupper((string) $token->value);
125
-                if (($token->type !== TokenType::Keyword) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) {
125
+                if (($token->type !== TokenType::Keyword) || (!($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) {
126 126
                     $parser->error('Unrecognized data type.', $token);
127 127
                 }
128 128
 
Please login to merge, or discard this patch.
src/Components/Condition.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     public $expr;
79 79
 
80 80
     /** @param string $expr the condition or the operator */
81
-    public function __construct(string|null $expr = null)
81
+    public function __construct(string | null $expr = null)
82 82
     {
83 83
         $this->expr = trim((string) $expr);
84 84
     }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                 } else {
146 146
                     // The expression ended.
147 147
                     $expr->expr = trim($expr->expr);
148
-                    if (! empty($expr->expr)) {
148
+                    if (!empty($expr->expr)) {
149 149
                         $ret[] = $expr;
150 150
                     }
151 151
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             if (
164 164
                 ($token->type === TokenType::Keyword)
165 165
                 && ($token->flags & Token::FLAG_KEYWORD_RESERVED)
166
-                && ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION)
166
+                && !($token->flags & Token::FLAG_KEYWORD_FUNCTION)
167 167
             ) {
168 168
                 if ($token->value === 'BETWEEN') {
169 169
                     $betweenBefore = true;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
         // Last iteration was not processed.
208 208
         $expr->expr = trim($expr->expr);
209
-        if (! empty($expr->expr)) {
209
+        if (!empty($expr->expr)) {
210 210
             $ret[] = $expr;
211 211
         }
212 212
 
Please login to merge, or discard this patch.
src/Components/IntoKeyword.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
      * @param bool|null              $fieldsKeyword options for OPTIONS keyword
114 114
      */
115 115
     public function __construct(
116
-        string|null $type = null,
117
-        string|Expression|null $dest = null,
118
-        array|null $columns = null,
119
-        array|null $values = null,
120
-        OptionsArray|null $fieldsOptions = null,
121
-        bool|null $fieldsKeyword = null,
116
+        string | null $type = null,
117
+        string | Expression | null $dest = null,
118
+        array | null $columns = null,
119
+        array | null $values = null,
120
+        OptionsArray | null $fieldsOptions = null,
121
+        bool | null $fieldsKeyword = null,
122 122
     ) {
123 123
         $this->type = $type;
124 124
         $this->dest = $dest;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     public function build(): string
255 255
     {
256 256
         if ($this->dest instanceof Expression) {
257
-            $columns = ! empty($this->columns) ? '(`' . implode('`, `', $this->columns) . '`)' : '';
257
+            $columns = !empty($this->columns) ? '(`' . implode('`, `', $this->columns) . '`)' : '';
258 258
 
259 259
             return $this->dest . $columns;
260 260
         }
Please login to merge, or discard this patch.
src/Components/JoinKeyword.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
      * @param ArrayObj    $using columns joined
80 80
      */
81 81
     public function __construct(
82
-        string|null $type = null,
83
-        Expression|null $expr = null,
84
-        array|null $on = null,
85
-        ArrayObj|null $using = null,
82
+        string | null $type = null,
83
+        Expression | null $expr = null,
84
+        array | null $on = null,
85
+        ArrayObj | null $using = null,
86 86
     ) {
87 87
         $this->type = $type;
88 88
         $this->expr = $expr;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             }
193 193
         }
194 194
 
195
-        if (! empty($expr->type)) {
195
+        if (!empty($expr->type)) {
196 196
             $ret[] = $expr;
197 197
         }
198 198
 
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
         $ret = [];
213 213
         foreach ($component as $c) {
214 214
             $ret[] = array_search($c->type, self::JOINS) . ' ' . $c->expr
215
-                . (! empty($c->on)
215
+                . (!empty($c->on)
216 216
                     ? ' ON ' . Condition::buildAll($c->on) : '')
217
-                . (! empty($c->using)
217
+                . (!empty($c->using)
218 218
                     ? ' USING ' . $c->using->build() : '');
219 219
         }
220 220
 
Please login to merge, or discard this patch.
src/Components/IndexHint.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,17 +19,17 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * The type of hint (USE/FORCE/IGNORE)
21 21
      */
22
-    public string|null $type;
22
+    public string | null $type;
23 23
 
24 24
     /**
25 25
      * What the hint is for (INDEX/KEY)
26 26
      */
27
-    public string|null $indexOrKey;
27
+    public string | null $indexOrKey;
28 28
 
29 29
     /**
30 30
      * The clause for which this hint is (JOIN/ORDER BY/GROUP BY)
31 31
      */
32
-    public string|null $for;
32
+    public string | null $for;
33 33
 
34 34
     /**
35 35
      * List of indexes in this hint
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
      * @param Expression[] $indexes    List of indexes in this hint
46 46
      */
47 47
     public function __construct(
48
-        string|null $type = null,
49
-        string|null $indexOrKey = null,
50
-        string|null $for = null,
48
+        string | null $type = null,
49
+        string | null $indexOrKey = null,
50
+        string | null $for = null,
51 51
         array $indexes = [],
52 52
     ) {
53 53
         $this->type = $type;
Please login to merge, or discard this patch.
src/Components/Expression.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
      * @param string|null $alias    the name of the alias
113 113
      */
114 114
     public function __construct(
115
-        string|null $database = null,
116
-        string|null $table = null,
117
-        string|null $column = null,
118
-        string|null $alias = null,
115
+        string | null $database = null,
116
+        string | null $table = null,
117
+        string | null $column = null,
118
+        string | null $alias = null,
119 119
     ) {
120 120
         if (($column === null) && ($alias === null)) {
121 121
             $this->expr = $database; // case 1
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      *
161 161
      * @throws ParserException
162 162
      */
163
-    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null
163
+    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null
164 164
     {
165 165
         $ret = new static();
166 166
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         ];
204 204
 
205 205
         // When a field is parsed, no parentheses are expected.
206
-        if (! empty($options['parseField'])) {
206
+        if (!empty($options['parseField'])) {
207 207
             $options['breakOnParentheses'] = true;
208 208
             $options['field'] = $options['parseField'];
209 209
         }
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
             }
231 231
 
232 232
             if ($token->type === TokenType::Keyword) {
233
-                if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
233
+                if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
234 234
                     // A `(` was previously found and this keyword is the
235 235
                     // beginning of a statement, so this is a subquery.
236 236
                     $ret->subquery = $token->keyword;
237 237
                 } elseif (
238 238
                     ($token->flags & Token::FLAG_KEYWORD_FUNCTION)
239 239
                     && (empty($options['parseField'])
240
-                    && ! $alias)
240
+                    && !$alias)
241 241
                 ) {
242 242
                     $isExpr = true;
243 243
                 } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                     }
250 250
 
251 251
                     if ($token->keyword === 'AS') {
252
-                        if (! empty($options['breakOnAlias'])) {
252
+                        if (!empty($options['breakOnAlias'])) {
253 253
                             break;
254 254
                         }
255 255
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                     }
273 273
 
274 274
                     $isExpr = true;
275
-                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) {
275
+                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) {
276 276
                     /* End of expression */
277 277
                     break;
278 278
                 }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                 || (($token->type === TokenType::Operator)
289 289
                 && ($token->value !== '.'))
290 290
             ) {
291
-                if (! empty($options['parseField'])) {
291
+                if (!empty($options['parseField'])) {
292 292
                     break;
293 293
                 }
294 294
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             }
299 299
 
300 300
             if ($token->type === TokenType::Operator) {
301
-                if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
301
+                if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
302 302
                     // No brackets were expected.
303 303
                     break;
304 304
                 }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
                     --$brackets;
324 324
                     if ($brackets === 0) {
325
-                        if (! empty($options['parenthesesDelimited'])) {
325
+                        if (!empty($options['parenthesesDelimited'])) {
326 326
                             // The current token is the last bracket, the next
327 327
                             // one will be outside the expression.
328 328
                             $ret->expr .= $token->token;
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
             if ($alias) {
350 350
                 // An alias is expected (the keyword `AS` was previously found).
351
-                if (! empty($ret->alias)) {
351
+                if (!empty($ret->alias)) {
352 352
                     $parser->error('An alias was previously found.', $token);
353 353
                     break;
354 354
                 }
@@ -362,15 +362,15 @@  discard block
 block discarded – undo
362 362
                     && ($prev[0] === null
363 363
                         || (($prev[0]->type !== TokenType::Operator || $prev[0]->token === ')')
364 364
                             && ($prev[0]->type !== TokenType::Keyword
365
-                                || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
365
+                                || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
366 366
                     && (($prev[1]->type === TokenType::String)
367 367
                         || ($prev[1]->type === TokenType::Symbol
368
-                            && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)
369
-                            && ! ($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER))
368
+                            && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)
369
+                            && !($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER))
370 370
                         || ($prev[1]->type === TokenType::None
371 371
                             && $prev[1]->token !== 'OVER'))
372 372
                 ) {
373
-                    if (! empty($ret->alias)) {
373
+                    if (!empty($ret->alias)) {
374 374
                         $parser->error('An alias was previously found.', $token);
375 375
                         break;
376 376
                     }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                     // Found a `.` which means we expect a column name and
402 402
                     // the column name we parsed is actually the table name
403 403
                     // and the table name is actually a database name.
404
-                    if (! empty($ret->database) || $dot) {
404
+                    if (!empty($ret->database) || $dot) {
405 405
                         $parser->error('Unexpected dot.', $token);
406 406
                     }
407 407
 
@@ -418,11 +418,11 @@  discard block
 block discarded – undo
418 418
                         $dot = false;
419 419
                     } else {
420 420
                         // No alias is expected.
421
-                        if (! empty($options['breakOnAlias'])) {
421
+                        if (!empty($options['breakOnAlias'])) {
422 422
                             break;
423 423
                         }
424 424
 
425
-                        if (! empty($ret->alias)) {
425
+                        if (!empty($ret->alias)) {
426 426
                             $parser->error('An alias was previously found.', $token);
427 427
                             break;
428 428
                         }
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
             $ret = implode('.', Context::escapeAll($fields));
471 471
         }
472 472
 
473
-        if (! empty($this->alias)) {
473
+        if (!empty($this->alias)) {
474 474
             $ret .= ' AS ' . Context::escape($this->alias);
475 475
         }
476 476
 
Please login to merge, or discard this patch.
src/Components/Key.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
      * @phpstan-param array{name?: string, length?: int, order?: string}[] $columns
106 106
      */
107 107
     public function __construct(
108
-        string|null $name = null,
108
+        string | null $name = null,
109 109
         array $columns = [],
110
-        string|null $type = null,
111
-        OptionsArray|null $options = null,
110
+        string | null $type = null,
111
+        OptionsArray | null $options = null,
112 112
     ) {
113 113
         $this->name = $name;
114 114
         $this->columns = $columns;
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
             } elseif ($state === 1) {
175 175
                 if (($token->type === TokenType::Operator) && ($token->value === '(')) {
176 176
                     $positionBeforeSearch = $list->idx;
177
-                    $list->idx++;// Ignore the current token "(" or the search condition will always be true
177
+                    $list->idx++; // Ignore the current token "(" or the search condition will always be true
178 178
                     $nextToken = $list->getNext();
179
-                    $list->idx = $positionBeforeSearch;// Restore the position
179
+                    $list->idx = $positionBeforeSearch; // Restore the position
180 180
 
181 181
                     if ($nextToken !== null && $nextToken->value === '(') {
182 182
                         // Switch to expression mode
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                 if ($token->type === TokenType::Operator) {
226 226
                     // This got back to here and we reached the end of the expression
227 227
                     if ($token->value === ')') {
228
-                        $state = 4;// go back to state 4 to fetch options
228
+                        $state = 4; // go back to state 4 to fetch options
229 229
                         continue;
230 230
                     }
231 231
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     public function build(): string
262 262
     {
263 263
         $ret = $this->type . ' ';
264
-        if (! empty($this->name)) {
264
+        if (!empty($this->name)) {
265 265
             $ret .= Context::escape($this->name) . ' ';
266 266
         }
267 267
 
Please login to merge, or discard this patch.
src/Components/PartitionDefinition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@
 block discarded – undo
231 231
         return trim(
232 232
             'PARTITION ' . $this->name
233 233
             . (empty($this->type) ? '' : ' VALUES ' . $this->type . ' ' . $this->expr . ' ')
234
-            . (! empty($this->options) && ! empty($this->type) ? '' : ' ')
234
+            . (!empty($this->options) && !empty($this->type) ? '' : ' ')
235 235
             . $this->options . $subpartitions,
236 236
         );
237 237
     }
Please login to merge, or discard this patch.