Passed
Pull Request — master (#334)
by Antoine
10:22
created
src/Token.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
         switch ($this->type) {
223 223
             case self::TYPE_KEYWORD:
224 224
                 $this->keyword = strtoupper($this->token);
225
-                if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) {
225
+                if (!($this->flags & self::FLAG_KEYWORD_RESERVED)) {
226 226
                     // Unreserved keywords should stay the way they are because they
227 227
                     // might represent field names.
228 228
                     return $this->token;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                 || ($this->flags & self::FLAG_NUMBER_FLOAT)
247 247
                 ) {
248 248
                     $ret = (float) $ret;
249
-                } elseif (! ($this->flags & self::FLAG_NUMBER_BINARY)) {
249
+                } elseif (!($this->flags & self::FLAG_NUMBER_BINARY)) {
250 250
                     $ret = (int) $ret;
251 251
                 }
252 252
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                     // in PHP 5.3- the `null` parameter isn't handled correctly.
280 280
                     $str = mb_substr(
281 281
                         $str,
282
-                        ! empty($str[1]) && ($str[1] === '@') ? 2 : 1,
282
+                        !empty($str[1]) && ($str[1] === '@') ? 2 : 1,
283 283
                         mb_strlen($str),
284 284
                         'UTF-8'
285 285
                     );
Please login to merge, or discard this patch.
src/Context.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         $str = strtoupper($str);
278 278
 
279 279
         if (isset(static::$KEYWORDS[$str])) {
280
-            if ($isReserved && ! (static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) {
280
+            if ($isReserved && !(static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) {
281 281
                 return null;
282 282
             }
283 283
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public static function isOperator($str)
301 301
     {
302
-        if (! isset(static::$OPERATORS[$str])) {
302
+        if (!isset(static::$OPERATORS[$str])) {
303 303
             return null;
304 304
         }
305 305
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
             $context = self::$contextPrefix . $context;
502 502
         }
503 503
 
504
-        if (! class_exists($context)) {
504
+        if (!class_exists($context)) {
505 505
             throw @new LoaderException(
506 506
                 'Specified context ("' . $context . '") does not exist.',
507 507
                 $context
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
                     $i -= 2;
541 541
                     $part = substr($context, $i, 2);
542 542
                     /* No more numeric parts to strip */
543
-                    if (! is_numeric($part)) {
543
+                    if (!is_numeric($part)) {
544 544
                         break 2;
545 545
                     }
546 546
                 } while (intval($part) === 0 && $i > 0);
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
         }
597 597
 
598 598
         if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES)
599
-            && (! static::isKeyword($str, true))
599
+            && (!static::isKeyword($str, true))
600 600
         ) {
601 601
             return $str;
602 602
         }
Please login to merge, or discard this patch.
src/Components/OptionsArray.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             }
160 160
 
161 161
             if ($state === 0) {
162
-                if (! is_array($lastOption)) {
162
+                if (!is_array($lastOption)) {
163 163
                     // This is a just keyword option without any value.
164 164
                     // This is the beginning and the end of it.
165 165
                     $ret->options[$lastOptionId] = $token->value;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
                     $ret->options[$lastOptionId]['expr'] .= $token->token;
231 231
 
232
-                    if (! (($token->token === '(') && ($brackets === 1)
232
+                    if (!(($token->token === '(') && ($brackets === 1)
233 233
                         || (($token->token === ')') && ($brackets === 0)))
234 234
                     ) {
235 235
                         // First pair of brackets is being skipped.
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
 
288 288
         $options = [];
289 289
         foreach ($component->options as $option) {
290
-            if (! is_array($option)) {
290
+            if (!is_array($option)) {
291 291
                 $options[] = $option;
292 292
             } else {
293 293
                 $options[] = $option['name']
294
-                    . (! empty($option['equals']) && $option['equals'] ? '=' : ' ')
295
-                    . (! empty($option['expr']) ? $option['expr'] : $option['value']);
294
+                    . (!empty($option['equals']) && $option['equals'] ? '=' : ' ')
295
+                    . (!empty($option['expr']) ? $option['expr'] : $option['value']);
296 296
             }
297 297
         }
298 298
 
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
     {
313 313
         foreach ($this->options as $option) {
314 314
             if (is_array($option)) {
315
-                if (! strcasecmp($key, $option['name'])) {
315
+                if (!strcasecmp($key, $option['name'])) {
316 316
                     return $getExpr ? $option['expr'] : $option['value'];
317 317
                 }
318
-            } elseif (! strcasecmp($key, $option)) {
318
+            } elseif (!strcasecmp($key, $option)) {
319 319
                 return true;
320 320
             }
321 321
         }
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
     {
335 335
         foreach ($this->options as $idx => $option) {
336 336
             if (is_array($option)) {
337
-                if (! strcasecmp($key, $option['name'])) {
337
+                if (!strcasecmp($key, $option['name'])) {
338 338
                     unset($this->options[$idx]);
339 339
 
340 340
                     return true;
341 341
                 }
342
-            } elseif (! strcasecmp($key, $option)) {
342
+            } elseif (!strcasecmp($key, $option)) {
343 343
                 unset($this->options[$idx]);
344 344
 
345 345
                 return true;
Please login to merge, or discard this patch.
src/Components/Key.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                         $state = 3;
160 160
                     } elseif (($token->value === ',') || ($token->value === ')')) {
161 161
                         $state = $token->value === ',' ? 2 : 4;
162
-                        if (! empty($lastColumn)) {
162
+                        if (!empty($lastColumn)) {
163 163
                             $ret->columns[] = $lastColumn;
164 164
                             $lastColumn = [];
165 165
                         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     public static function build($component, array $options = [])
195 195
     {
196 196
         $ret = $component->type . ' ';
197
-        if (! empty($component->name)) {
197
+        if (!empty($component->name)) {
198 198
             $ret .= Context::escape($component->name) . ' ';
199 199
         }
200 200
 
Please login to merge, or discard this patch.
src/Components/JoinKeyword.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
             if ($state === 0) {
150 150
                 if (($token->type === Token::TYPE_KEYWORD)
151
-                    && ! empty(static::$JOINS[$token->keyword])
151
+                    && !empty(static::$JOINS[$token->keyword])
152 152
                 ) {
153 153
                     $expr->type = static::$JOINS[$token->keyword];
154 154
                     $state = 1;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                             $state = 4;
169 169
                             break;
170 170
                         default:
171
-                            if (! empty(static::$JOINS[$token->keyword])
171
+                            if (!empty(static::$JOINS[$token->keyword])
172 172
                             ) {
173 173
                                 $ret[] = $expr;
174 174
                                 $expr = new static();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             }
196 196
         }
197 197
 
198
-        if (! empty($expr->type)) {
198
+        if (!empty($expr->type)) {
199 199
             $ret[] = $expr;
200 200
         }
201 201
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
         $ret = [];
216 216
         foreach ($component as $c) {
217 217
             $ret[] = array_search($c->type, static::$JOINS) . ' ' . $c->expr
218
-                . (! empty($c->on)
218
+                . (!empty($c->on)
219 219
                     ? ' ON ' . Condition::build($c->on) : '')
220
-                . (! empty($c->using)
220
+                . (!empty($c->using)
221 221
                     ? ' USING ' . ArrayObj::build($c->using) : '');
222 222
         }
223 223
 
Please login to merge, or discard this patch.
src/Components/DataType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
             if ($state === 0) {
129 129
                 $ret->name = strtoupper((string) $token->value);
130
-                if (($token->type !== Token::TYPE_KEYWORD) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) {
130
+                if (($token->type !== Token::TYPE_KEYWORD) || (!($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) {
131 131
                     $parser->error('Unrecognized data type.', $token);
132 132
                 }
133 133
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             $component->name : strtolower($component->name);
168 168
 
169 169
         $parameters = '';
170
-        if (! empty($component->parameters)) {
170
+        if (!empty($component->parameters)) {
171 171
             $parameters = '(' . implode(',', $component->parameters) . ')';
172 172
         }
173 173
 
Please login to merge, or discard this patch.
src/Components/IntoKeyword.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@
 block discarded – undo
271 271
     public static function build($component, array $options = [])
272 272
     {
273 273
         if ($component->dest instanceof Expression) {
274
-            $columns = ! empty($component->columns) ? '(`' . implode('`, `', $component->columns) . '`)' : '';
274
+            $columns = !empty($component->columns) ? '(`' . implode('`, `', $component->columns) . '`)' : '';
275 275
 
276 276
             return $component->dest . $columns;
277 277
         } elseif (isset($component->values)) {
Please login to merge, or discard this patch.
src/Components/Expression.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         ];
201 201
 
202 202
         // When a field is parsed, no parentheses are expected.
203
-        if (! empty($options['parseField'])) {
203
+        if (!empty($options['parseField'])) {
204 204
             $options['breakOnParentheses'] = true;
205 205
             $options['field'] = $options['parseField'];
206 206
         }
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
 
232 232
             if ($token->type === Token::TYPE_KEYWORD) {
233 233
                 if (($brackets > 0) && empty($ret->subquery)
234
-                    && ! empty(Parser::$STATEMENT_PARSERS[$token->keyword])
234
+                    && !empty(Parser::$STATEMENT_PARSERS[$token->keyword])
235 235
                 ) {
236 236
                     // A `(` was previously found and this keyword is the
237 237
                     // beginning of a statement, so this is a subquery.
238 238
                     $ret->subquery = $token->keyword;
239 239
                 } elseif (($token->flags & Token::FLAG_KEYWORD_FUNCTION)
240 240
                     && (empty($options['parseField'])
241
-                    && ! $alias)
241
+                    && !$alias)
242 242
                 ) {
243 243
                     $isExpr = true;
244 244
                 } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED)
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                     }
253 253
 
254 254
                     if ($token->keyword === 'AS') {
255
-                        if (! empty($options['breakOnAlias'])) {
255
+                        if (!empty($options['breakOnAlias'])) {
256 256
                             break;
257 257
                         }
258 258
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
                     }
277 277
 
278 278
                     $isExpr = true;
279
-                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) {
279
+                } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) {
280 280
                     /* End of expression */
281 281
                     break;
282 282
                 }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
                 || (($token->type === Token::TYPE_OPERATOR)
292 292
                 && ($token->value !== '.'))
293 293
             ) {
294
-                if (! empty($options['parseField'])) {
294
+                if (!empty($options['parseField'])) {
295 295
                     break;
296 296
                 }
297 297
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             }
302 302
 
303 303
             if ($token->type === Token::TYPE_OPERATOR) {
304
-                if (! empty($options['breakOnParentheses'])
304
+                if (!empty($options['breakOnParentheses'])
305 305
                     && (($token->value === '(') || ($token->value === ')'))
306 306
                 ) {
307 307
                     // No brackets were expected.
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                     } else {
326 326
                         --$brackets;
327 327
                         if ($brackets === 0) {
328
-                            if (! empty($options['parenthesesDelimited'])) {
328
+                            if (!empty($options['parenthesesDelimited'])) {
329 329
                                 // The current token is the last bracket, the next
330 330
                                 // one will be outside the expression.
331 331
                                 $ret->expr .= $token->token;
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
             if ($alias) {
354 354
                 // An alias is expected (the keyword `AS` was previously found).
355
-                if (! empty($ret->alias)) {
355
+                if (!empty($ret->alias)) {
356 356
                     $parser->error('An alias was previously found.', $token);
357 357
                     break;
358 358
                 }
@@ -365,13 +365,13 @@  discard block
 block discarded – undo
365 365
                     && ($prev[0] === null
366 366
                         || (($prev[0]->type !== Token::TYPE_OPERATOR || $prev[0]->token === ')')
367 367
                             && ($prev[0]->type !== Token::TYPE_KEYWORD
368
-                                || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
368
+                                || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED))))
369 369
                     && (($prev[1]->type === Token::TYPE_STRING)
370 370
                         || ($prev[1]->type === Token::TYPE_SYMBOL
371
-                            && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE))
371
+                            && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE))
372 372
                         || ($prev[1]->type === Token::TYPE_NONE))
373 373
                 ) {
374
-                    if (! empty($ret->alias)) {
374
+                    if (!empty($ret->alias)) {
375 375
                         $parser->error('An alias was previously found.', $token);
376 376
                         break;
377 377
                     }
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
                 } else {
381 381
                     $ret->expr .= $token->token;
382 382
                 }
383
-            } elseif (! $isExpr) {
383
+            } elseif (!$isExpr) {
384 384
                 if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '.')) {
385 385
                     // Found a `.` which means we expect a column name and
386 386
                     // the column name we parsed is actually the table name
387 387
                     // and the table name is actually a database name.
388
-                    if (! empty($ret->database) || $dot) {
388
+                    if (!empty($ret->database) || $dot) {
389 389
                         $parser->error('Unexpected dot.', $token);
390 390
                     }
391 391
 
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
                         $dot = false;
403 403
                     } else {
404 404
                         // No alias is expected.
405
-                        if (! empty($options['breakOnAlias'])) {
405
+                        if (!empty($options['breakOnAlias'])) {
406 406
                             break;
407 407
                         }
408 408
 
409
-                        if (! empty($ret->alias)) {
409
+                        if (!empty($ret->alias)) {
410 410
                             $parser->error('An alias was previously found.', $token);
411 411
                             break;
412 412
                         }
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
             $ret = implode('.', Context::escape($fields));
468 468
         }
469 469
 
470
-        if (! empty($component->alias)) {
470
+        if (!empty($component->alias)) {
471 471
             $ret .= ' AS ' . Context::escape($component->alias);
472 472
         }
473 473
 
Please login to merge, or discard this patch.
src/Components/CreateDefinition.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                     $state = 4;
245 245
                 } elseif ($token->type === Token::TYPE_SYMBOL || $token->type === Token::TYPE_NONE) {
246 246
                     $expr->name = $token->value;
247
-                    if (! $expr->isConstraint) {
247
+                    if (!$expr->isConstraint) {
248 248
                         $state = 2;
249 249
                     }
250 250
                 } elseif ($token->type === Token::TYPE_KEYWORD) {
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
                 $state = 5;
290 290
             } elseif ($state === 5) {
291
-                if (! empty($expr->type) || ! empty($expr->key)) {
291
+                if (!empty($expr->type) || !empty($expr->key)) {
292 292
                     $ret[] = $expr;
293 293
                 }
294 294
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
         }
312 312
 
313 313
         // Last iteration was not saved.
314
-        if (! empty($expr->type) || ! empty($expr->key)) {
314
+        if (!empty($expr->type) || !empty($expr->key)) {
315 315
             $ret[] = $expr;
316 316
         }
317 317
 
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
             $tmp .= Context::escape($component->name) . ' ';
350 350
         }
351 351
 
352
-        if (! empty($component->type)) {
352
+        if (!empty($component->type)) {
353 353
             $tmp .= DataType::build(
354 354
                 $component->type,
355 355
                 ['lowercase' => true]
356 356
             ) . ' ';
357 357
         }
358 358
 
359
-        if (! empty($component->key)) {
359
+        if (!empty($component->key)) {
360 360
             $tmp .= $component->key . ' ';
361 361
         }
362 362
 
363
-        if (! empty($component->references)) {
363
+        if (!empty($component->references)) {
364 364
             $tmp .= 'REFERENCES ' . $component->references . ' ';
365 365
         }
366 366
 
Please login to merge, or discard this patch.