Passed
Pull Request — master (#521)
by
unknown
04:59
created
src/Utils/Table.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public static function getForeignKeys(CreateStatement $statement): array
32 32
     {
33
-        if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) {
33
+        if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) {
34 34
             return [];
35 35
         }
36 36
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
             $columns = [];
45 45
             foreach ($field->key->columns as $column) {
46
-                if (! isset($column['name'])) {
46
+                if (!isset($column['name'])) {
47 47
                     continue;
48 48
                 }
49 49
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 'index_list' => $columns,
56 56
             ];
57 57
 
58
-            if (! empty($field->references)) {
58
+            if (!empty($field->references)) {
59 59
                 $tmp['ref_db_name'] = $field->references->table->database;
60 60
                 $tmp['ref_table_name'] = $field->references->table->table;
61 61
                 $tmp['ref_index_list'] = $field->references->columns;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public static function getFields(CreateStatement $statement): array
98 98
     {
99
-        if (empty($statement->fields) || (! is_array($statement->fields)) || (! $statement->options->has('TABLE'))) {
99
+        if (empty($statement->fields) || (!is_array($statement->fields)) || (!$statement->options->has('TABLE'))) {
100 100
             return [];
101 101
         }
102 102
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 'timestamp_not_null' => false,
114 114
             ];
115 115
 
116
-            if (! $field->options) {
116
+            if (!$field->options) {
117 117
                 continue;
118 118
             }
119 119
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
             $option = $field->options->has('AS');
142 142
 
143
-            if (! $option) {
143
+            if (!$option) {
144 144
                 continue;
145 145
             }
146 146
 
Please login to merge, or discard this patch.
src/Components/Limit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param int|string $rowCount the row count
34 34
      * @param int|string $offset   the offset
35 35
      */
36
-    public function __construct(int|string $rowCount = 0, int|string $offset = 0)
36
+    public function __construct(int | string $rowCount = 0, int | string $offset = 0)
37 37
     {
38 38
         $this->rowCount = $rowCount;
39 39
         $this->offset = $offset;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
             // Skip if not a number or a bind parameter (?)
89 89
             if (
90
-                ! ($token->type === TokenType::Number
90
+                !($token->type === TokenType::Number
91 91
                     || ($token->type === TokenType::Symbol && ($token->flags & Token::FLAG_SYMBOL_PARAMETER)))
92 92
             ) {
93 93
                 break;
Please login to merge, or discard this patch.
src/Components/FunctionCall.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * @param string|null            $name       the name of the function to be called
35 35
      * @param string[]|ArrayObj|null $parameters the parameters of this function
36 36
      */
37
-    public function __construct(string|null $name = null, array|ArrayObj|null $parameters = null)
37
+    public function __construct(string | null $name = null, array | ArrayObj | null $parameters = null)
38 38
     {
39 39
         $this->name = $name;
40 40
         if (is_array($parameters)) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 if ($token->type === TokenType::Operator && $token->value === '(') {
88 88
                     --$list->idx; // ArrayObj needs to start with `(`
89 89
                     $state = 1;
90
-                    continue;// do not add this token to the name
90
+                    continue; // do not add this token to the name
91 91
                 }
92 92
 
93 93
                 $ret->name .= $token->value;
Please login to merge, or discard this patch.
src/Components/RenameOperation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * @param Expression $old old expression
35 35
      * @param Expression $new new expression containing new name
36 36
      */
37
-    public function __construct(Expression|null $old = null, Expression|null $new = null)
37
+    public function __construct(Expression | null $old = null, Expression | null $new = null)
38 38
     {
39 39
         $this->old = $old;
40 40
         $this->new = $new;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         }
139 139
 
140 140
         // Last iteration was not saved.
141
-        if (! empty($expr->old)) {
141
+        if (!empty($expr->old)) {
142 142
             $ret[] = $expr;
143 143
         }
144 144
 
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/Condition.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     /**
81 81
      * @param string $expr the condition or the operator
82 82
      */
83
-    public function __construct(string|null $expr = null)
83
+    public function __construct(string | null $expr = null)
84 84
     {
85 85
         $this->expr = trim((string) $expr);
86 86
     }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                 } else {
148 148
                     // The expression ended.
149 149
                     $expr->expr = trim($expr->expr);
150
-                    if (! empty($expr->expr)) {
150
+                    if (!empty($expr->expr)) {
151 151
                         $ret[] = $expr;
152 152
                     }
153 153
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             if (
166 166
                 ($token->type === TokenType::Keyword)
167 167
                 && ($token->flags & Token::FLAG_KEYWORD_RESERVED)
168
-                && ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION)
168
+                && !($token->flags & Token::FLAG_KEYWORD_FUNCTION)
169 169
             ) {
170 170
                 if ($token->value === 'BETWEEN') {
171 171
                     $betweenBefore = true;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
         // Last iteration was not processed.
210 210
         $expr->expr = trim($expr->expr);
211
-        if (! empty($expr->expr)) {
211
+        if (!empty($expr->expr)) {
212 212
             $ret[] = $expr;
213 213
         }
214 214
 
Please login to merge, or discard this patch.
src/Components/GroupKeyword.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 final class GroupKeyword implements Component
19 19
 {
20 20
     /** @var 'ASC'|'DESC'|null */
21
-    public string|null $type = null;
21
+    public string | null $type = null;
22 22
 
23 23
     /**
24 24
      * The expression that is used for grouping.
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * @param Expression $expr the expression that we are sorting by
32 32
      */
33
-    public function __construct(Expression|null $expr = null)
33
+    public function __construct(Expression | null $expr = null)
34 34
     {
35 35
         $this->expr = $expr;
36 36
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 ) {
89 89
                     $expr->type = $token->keyword;
90 90
                 } elseif (($token->type === TokenType::Operator) && ($token->value === ',')) {
91
-                    if (! empty($expr->expr)) {
91
+                    if (!empty($expr->expr)) {
92 92
                         $ret[] = $expr;
93 93
                     }
94 94
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
 
103 103
         // Last iteration was not processed.
104
-        if (! empty($expr->expr)) {
104
+        if (!empty($expr->expr)) {
105 105
             $ret[] = $expr;
106 106
         }
107 107
 
Please login to merge, or discard this patch.
src/Components/AlterOperation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
      * @param Token[]                    $unknown    unparsed tokens found at the end of operation
265 265
      */
266 266
     public function __construct(
267
-        OptionsArray|null $options = null,
268
-        Expression|string|null $field = null,
269
-        array|null $partitions = null,
267
+        OptionsArray | null $options = null,
268
+        Expression | string | null $field = null,
269
+        array | null $partitions = null,
270 270
         public array $unknown = []
271 271
     ) {
272 272
         $this->partitions = $partitions;
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                     } elseif (($token->value === ',') && ($brackets === 0)) {
402 402
                         break;
403 403
                     }
404
-                } elseif (! self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) {
404
+                } elseif (!self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) {
405 405
                     if (isset(Parser::STATEMENT_PARSERS[$arrayKey]) && Parser::STATEMENT_PARSERS[$arrayKey] !== '') {
406 406
                         $list->idx++; // Ignore the current token
407 407
                         $nextToken = $list->getNext();
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                     } elseif (
425 425
                         (array_key_exists($arrayKey, self::DATABASE_OPTIONS)
426 426
                         || array_key_exists($arrayKey, self::TABLE_OPTIONS))
427
-                        && ! self::checkIfColumnDefinitionKeyword($arrayKey)
427
+                        && !self::checkIfColumnDefinitionKeyword($arrayKey)
428 428
                     ) {
429 429
                         // This alter operation has finished, which means a comma
430 430
                         // was missing before start of new alter operation
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
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
      * @param string|null $alias    the name of the alias
112 112
      */
113 113
     public function __construct(
114
-        string|null $database = null,
115
-        string|null $table = null,
116
-        string|null $column = null,
117
-        string|null $alias = null
114
+        string | null $database = null,
115
+        string | null $table = null,
116
+        string | null $column = null,
117
+        string | null $alias = null
118 118
     ) {
119 119
         if (($column === null) && ($alias === null)) {
120 120
             $this->expr = $database; // case 1
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      *
160 160
      * @throws ParserException
161 161
      */
162
-    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null
162
+    public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null
163 163
     {
164 164
         $ret = new static();
165 165
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         ];
203 203
 
204 204
         // When a field is parsed, no parentheses are expected.
205
-        if (! empty($options['parseField'])) {
205
+        if (!empty($options['parseField'])) {
206 206
             $options['breakOnParentheses'] = true;
207 207
             $options['field'] = $options['parseField'];
208 208
         }
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
             }
230 230
 
231 231
             if ($token->type === TokenType::Keyword) {
232
-                if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
232
+                if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) {
233 233
                     // A `(` was previously found and this keyword is the
234 234
                     // beginning of a statement, so this is a subquery.
235 235
                     $ret->subquery = $token->keyword;
236 236
                 } elseif (
237 237
                     ($token->flags & Token::FLAG_KEYWORD_FUNCTION)
238 238
                     && (empty($options['parseField'])
239
-                    && ! $alias)
239
+                    && !$alias)
240 240
                 ) {
241 241
                     $isExpr = true;
242 242
                 } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                     }
249 249
 
250 250
                     if ($token->keyword === 'AS') {
251
-                        if (! empty($options['breakOnAlias'])) {
251
+                        if (!empty($options['breakOnAlias'])) {
252 252
                             break;
253 253
                         }
254 254
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                     }
272 272
 
273 273
                     $isExpr = true;
274
-                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) {
274
+                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) {
275 275
                     /* End of expression */
276 276
                     break;
277 277
                 }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                 || (($token->type === TokenType::Operator)
288 288
                 && ($token->value !== '.'))
289 289
             ) {
290
-                if (! empty($options['parseField'])) {
290
+                if (!empty($options['parseField'])) {
291 291
                     break;
292 292
                 }
293 293
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
             }
298 298
 
299 299
             if ($token->type === TokenType::Operator) {
300
-                if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
300
+                if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) {
301 301
                     // No brackets were expected.
302 302
                     break;
303 303
                 }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
                     --$brackets;
323 323
                     if ($brackets === 0) {
324
-                        if (! empty($options['parenthesesDelimited'])) {
324
+                        if (!empty($options['parenthesesDelimited'])) {
325 325
                             // The current token is the last bracket, the next
326 326
                             // one will be outside the expression.
327 327
                             $ret->expr .= $token->token;
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
             if ($alias) {
349 349
                 // An alias is expected (the keyword `AS` was previously found).
350
-                if (! empty($ret->alias)) {
350
+                if (!empty($ret->alias)) {
351 351
                     $parser->error('An alias was previously found.', $token);
352 352
                     break;
353 353
                 }
@@ -361,15 +361,15 @@  discard block
 block discarded – undo
361 361
                     && ($prev[0] === null
362 362
                         || (($prev[0]->type !== TokenType::Operator || $prev[0]->token === ')')
363 363
                             && ($prev[0]->type !== TokenType::Keyword
364
-                                || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
364
+                                || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
365 365
                     && (($prev[1]->type === TokenType::String)
366 366
                         || ($prev[1]->type === TokenType::Symbol
367
-                            && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)
368
-                            && ! ($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER))
367
+                            && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE)
368
+                            && !($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER))
369 369
                         || ($prev[1]->type === TokenType::None
370 370
                             && $prev[1]->token !== 'OVER'))
371 371
                 ) {
372
-                    if (! empty($ret->alias)) {
372
+                    if (!empty($ret->alias)) {
373 373
                         $parser->error('An alias was previously found.', $token);
374 374
                         break;
375 375
                     }
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
                     // Found a `.` which means we expect a column name and
401 401
                     // the column name we parsed is actually the table name
402 402
                     // and the table name is actually a database name.
403
-                    if (! empty($ret->database) || $dot) {
403
+                    if (!empty($ret->database) || $dot) {
404 404
                         $parser->error('Unexpected dot.', $token);
405 405
                     }
406 406
 
@@ -417,11 +417,11 @@  discard block
 block discarded – undo
417 417
                         $dot = false;
418 418
                     } else {
419 419
                         // No alias is expected.
420
-                        if (! empty($options['breakOnAlias'])) {
420
+                        if (!empty($options['breakOnAlias'])) {
421 421
                             break;
422 422
                         }
423 423
 
424
-                        if (! empty($ret->alias)) {
424
+                        if (!empty($ret->alias)) {
425 425
                             $parser->error('An alias was previously found.', $token);
426 426
                             break;
427 427
                         }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             $ret = implode('.', Context::escapeAll($fields));
470 470
         }
471 471
 
472
-        if (! empty($this->alias)) {
472
+        if (!empty($this->alias)) {
473 473
             $ret .= ' AS ' . Context::escape($this->alias);
474 474
         }
475 475
 
Please login to merge, or discard this patch.