Completed
Pull Request — master (#1)
by Tomáš
06:48
created
CodeSniffer.php 1 patch
Switch Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1802,18 +1802,18 @@  discard block
 block discarded – undo
1802 1802
             $input = trim($input);
1803 1803
 
1804 1804
             switch ($input) {
1805
-            case 's':
1806
-                break(2);
1807
-            case 'q':
1808
-                exit(0);
1809
-                break;
1810
-            default:
1811
-                // Repopulate the sniffs because some of them save their state
1812
-                // and only clear it when the file changes, but we are rechecking
1813
-                // the same file.
1814
-                $this->populateTokenListeners();
1815
-                $phpcsFile = $this->_processFile($file, $contents);
1816
-                break;
1805
+                case 's':
1806
+                    break(2);
1807
+                case 'q':
1808
+                    exit(0);
1809
+                    break;
1810
+                default:
1811
+                    // Repopulate the sniffs because some of them save their state
1812
+                    // and only clear it when the file changes, but we are rechecking
1813
+                    // the same file.
1814
+                    $this->populateTokenListeners();
1815
+                    $phpcsFile = $this->_processFile($file, $contents);
1816
+                    break;
1817 1817
             }
1818 1818
         }//end while
1819 1819
 
@@ -2075,15 +2075,15 @@  discard block
 block discarded – undo
2075 2075
         } else {
2076 2076
             $lowerVarType = strtolower($varType);
2077 2077
             switch ($lowerVarType) {
2078
-            case 'bool':
2079
-                return 'boolean';
2080
-            case 'double':
2081
-            case 'real':
2082
-                return 'float';
2083
-            case 'int':
2084
-                return 'integer';
2085
-            case 'array()':
2086
-                return 'array';
2078
+                case 'bool':
2079
+                    return 'boolean';
2080
+                case 'double':
2081
+                case 'real':
2082
+                    return 'float';
2083
+                case 'int':
2084
+                    return 'integer';
2085
+                case 'array()':
2086
+                    return 'array';
2087 2087
             }//end switch
2088 2088
 
2089 2089
             if (strpos($lowerVarType, 'array(') !== false) {
Please login to merge, or discard this patch.
CodeSniffer/Tokenizers/CSS.php 1 patch
Switch Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -283,12 +283,32 @@  discard block
 block discarded – undo
283 283
             }
284 284
 
285 285
             switch ($token['code']) {
286
-            case T_OPEN_CURLY_BRACKET:
287
-                // Opening curly brackets for an At-rule do not start a style
288
-                // definition. We also reset the asperand flag here because the next
289
-                // opening curly bracket could be indeed the start of a style
290
-                // definition.
291
-                if ($asperandStart === true) {
286
+                case T_OPEN_CURLY_BRACKET:
287
+                    // Opening curly brackets for an At-rule do not start a style
288
+                    // definition. We also reset the asperand flag here because the next
289
+                    // opening curly bracket could be indeed the start of a style
290
+                    // definition.
291
+                    if ($asperandStart === true) {
292
+                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
293
+                            if ($inStyleDef === true) {
294
+                                echo "\t\t* style definition closed *".PHP_EOL;
295
+                            }
296
+
297
+                            if ($asperandStart === true) {
298
+                                echo "\t\t* at-rule definition closed *".PHP_EOL;
299
+                            }
300
+                        }
301
+
302
+                        $inStyleDef    = false;
303
+                        $asperandStart = false;
304
+                    } else {
305
+                        $inStyleDef = true;
306
+                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
307
+                            echo "\t\t* style definition opened *".PHP_EOL;
308
+                        }
309
+                    }
310
+                    break;
311
+                case T_CLOSE_CURLY_BRACKET:
292 312
                     if (PHP_CODESNIFFER_VERBOSITY > 1) {
293 313
                         if ($inStyleDef === true) {
294 314
                             echo "\t\t* style definition closed *".PHP_EOL;
@@ -301,162 +321,142 @@  discard block
 block discarded – undo
301 321
 
302 322
                     $inStyleDef    = false;
303 323
                     $asperandStart = false;
304
-                } else {
305
-                    $inStyleDef = true;
306
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
307
-                        echo "\t\t* style definition opened *".PHP_EOL;
308
-                    }
309
-                }
310
-                break;
311
-            case T_CLOSE_CURLY_BRACKET:
312
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
313
-                    if ($inStyleDef === true) {
314
-                        echo "\t\t* style definition closed *".PHP_EOL;
315
-                    }
316
-
317
-                    if ($asperandStart === true) {
318
-                        echo "\t\t* at-rule definition closed *".PHP_EOL;
319
-                    }
320
-                }
321
-
322
-                $inStyleDef    = false;
323
-                $asperandStart = false;
324
-                break;
325
-            case T_MINUS:
326
-                // Minus signs are often used instead of spaces inside
327
-                // class names, IDs and styles.
328
-                if ($finalTokens[($stackPtr + 1)]['code'] === T_STRING) {
329
-                    if ($finalTokens[($stackPtr - 1)]['code'] === T_STRING) {
330
-                        $newContent = $finalTokens[($stackPtr - 1)]['content'].'-'.$finalTokens[($stackPtr + 1)]['content'];
331
-
324
+                    break;
325
+                case T_MINUS:
326
+                    // Minus signs are often used instead of spaces inside
327
+                    // class names, IDs and styles.
328
+                    if ($finalTokens[($stackPtr + 1)]['code'] === T_STRING) {
329
+                        if ($finalTokens[($stackPtr - 1)]['code'] === T_STRING) {
330
+                            $newContent = $finalTokens[($stackPtr - 1)]['content'].'-'.$finalTokens[($stackPtr + 1)]['content'];
331
+
332
+                            if (PHP_CODESNIFFER_VERBOSITY > 1) {
333
+                                echo "\t\t* token is a string joiner; ignoring this and previous token".PHP_EOL;
334
+                                $old = PHP_CodeSniffer::prepareForOutput($finalTokens[($stackPtr + 1)]['content']);
335
+                                $new = PHP_CodeSniffer::prepareForOutput($newContent);
336
+                                echo "\t\t=> token ".($stackPtr + 1)." content changed from \"$old\" to \"$new\"".PHP_EOL;
337
+                            }
338
+
339
+                            $finalTokens[($stackPtr + 1)]['content'] = $newContent;
340
+                            unset($finalTokens[$stackPtr]);
341
+                            unset($finalTokens[($stackPtr - 1)]);
342
+                        } else {
343
+                            $newContent = '-'.$finalTokens[($stackPtr + 1)]['content'];
344
+
345
+                            $finalTokens[($stackPtr + 1)]['content'] = $newContent;
346
+                            unset($finalTokens[$stackPtr]);
347
+                        }
348
+                    } else if ($finalTokens[($stackPtr + 1)]['code'] === T_LNUMBER) {
349
+                        // They can also be used to provide negative numbers.
332 350
                         if (PHP_CODESNIFFER_VERBOSITY > 1) {
333
-                            echo "\t\t* token is a string joiner; ignoring this and previous token".PHP_EOL;
334
-                            $old = PHP_CodeSniffer::prepareForOutput($finalTokens[($stackPtr + 1)]['content']);
335
-                            $new = PHP_CodeSniffer::prepareForOutput($newContent);
336
-                            echo "\t\t=> token ".($stackPtr + 1)." content changed from \"$old\" to \"$new\"".PHP_EOL;
351
+                            echo "\t\t* token is part of a negative number; adding content to next token and ignoring *".PHP_EOL;
352
+                            $content = PHP_CodeSniffer::prepareForOutput($finalTokens[($stackPtr + 1)]['content']);
353
+                            echo "\t\t=> token ".($stackPtr + 1)." content changed from \"$content\" to \"-$content\"".PHP_EOL;
337 354
                         }
338 355
 
339
-                        $finalTokens[($stackPtr + 1)]['content'] = $newContent;
356
+                        $finalTokens[($stackPtr + 1)]['content'] = '-'.$finalTokens[($stackPtr + 1)]['content'];
340 357
                         unset($finalTokens[$stackPtr]);
341
-                        unset($finalTokens[($stackPtr - 1)]);
342
-                    } else {
343
-                        $newContent = '-'.$finalTokens[($stackPtr + 1)]['content'];
358
+                    }//end if
344 359
 
345
-                        $finalTokens[($stackPtr + 1)]['content'] = $newContent;
346
-                        unset($finalTokens[$stackPtr]);
347
-                    }
348
-                } else if ($finalTokens[($stackPtr + 1)]['code'] === T_LNUMBER) {
349
-                    // They can also be used to provide negative numbers.
350
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
351
-                        echo "\t\t* token is part of a negative number; adding content to next token and ignoring *".PHP_EOL;
352
-                        $content = PHP_CodeSniffer::prepareForOutput($finalTokens[($stackPtr + 1)]['content']);
353
-                        echo "\t\t=> token ".($stackPtr + 1)." content changed from \"$content\" to \"-$content\"".PHP_EOL;
354
-                    }
355
-
356
-                    $finalTokens[($stackPtr + 1)]['content'] = '-'.$finalTokens[($stackPtr + 1)]['content'];
357
-                    unset($finalTokens[$stackPtr]);
358
-                }//end if
359
-
360
-                break;
361
-            case T_COLON:
362
-                // Only interested in colons that are defining styles.
363
-                if ($inStyleDef === false) {
364 360
                     break;
365
-                }
366
-
367
-                for ($x = ($stackPtr - 1); $x >= 0; $x--) {
368
-                    if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$finalTokens[$x]['code']]) === false) {
361
+                case T_COLON:
362
+                    // Only interested in colons that are defining styles.
363
+                    if ($inStyleDef === false) {
369 364
                         break;
370 365
                     }
371
-                }
372 366
 
373
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
374
-                    $type = $finalTokens[$x]['type'];
375
-                    echo "\t\t=> token $x changed from $type to T_STYLE".PHP_EOL;
376
-                }
377
-
378
-                $finalTokens[$x]['type'] = 'T_STYLE';
379
-                $finalTokens[$x]['code'] = T_STYLE;
380
-                break;
381
-            case T_STRING:
382
-                if (strtolower($token['content']) === 'url') {
383
-                    // Find the next content.
384
-                    for ($x = ($stackPtr + 1); $x < $numTokens; $x++) {
367
+                    for ($x = ($stackPtr - 1); $x >= 0; $x--) {
385 368
                         if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$finalTokens[$x]['code']]) === false) {
386 369
                             break;
387 370
                         }
388 371
                     }
389 372
 
390
-                    // Needs to be in the format "url(" for it to be a URL.
391
-                    if ($finalTokens[$x]['code'] !== T_OPEN_PARENTHESIS) {
392
-                        continue;
373
+                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
374
+                        $type = $finalTokens[$x]['type'];
375
+                        echo "\t\t=> token $x changed from $type to T_STYLE".PHP_EOL;
393 376
                     }
394 377
 
395
-                    // Make sure the content isn't empty.
396
-                    for ($y = ($x + 1); $y < $numTokens; $y++) {
397
-                        if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$finalTokens[$y]['code']]) === false) {
398
-                            break;
378
+                    $finalTokens[$x]['type'] = 'T_STYLE';
379
+                    $finalTokens[$x]['code'] = T_STYLE;
380
+                    break;
381
+                case T_STRING:
382
+                    if (strtolower($token['content']) === 'url') {
383
+                        // Find the next content.
384
+                        for ($x = ($stackPtr + 1); $x < $numTokens; $x++) {
385
+                            if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$finalTokens[$x]['code']]) === false) {
386
+                                break;
387
+                            }
399 388
                         }
400
-                    }
401 389
 
402
-                    if ($finalTokens[$y]['code'] === T_CLOSE_PARENTHESIS) {
403
-                        continue;
404
-                    }
405
-
406
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
407
-                        for ($i = ($stackPtr + 1); $i <= $y; $i++) {
408
-                            $type    = $finalTokens[$i]['type'];
409
-                            $content = PHP_CodeSniffer::prepareForOutput($finalTokens[$i]['content']);
410
-                            echo "\tProcess token $i: $type => $content".PHP_EOL;
390
+                        // Needs to be in the format "url(" for it to be a URL.
391
+                        if ($finalTokens[$x]['code'] !== T_OPEN_PARENTHESIS) {
392
+                            continue;
411 393
                         }
412 394
 
413
-                        echo "\t\t* token starts a URL *".PHP_EOL;
414
-                    }
395
+                        // Make sure the content isn't empty.
396
+                        for ($y = ($x + 1); $y < $numTokens; $y++) {
397
+                            if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$finalTokens[$y]['code']]) === false) {
398
+                                break;
399
+                            }
400
+                        }
415 401
 
416
-                    // Join all the content together inside the url() statement.
417
-                    $newContent = '';
418
-                    for ($i = ($x + 2); $i < $numTokens; $i++) {
419
-                        if ($finalTokens[$i]['code'] === T_CLOSE_PARENTHESIS) {
420
-                            break;
402
+                        if ($finalTokens[$y]['code'] === T_CLOSE_PARENTHESIS) {
403
+                            continue;
421 404
                         }
422 405
 
423
-                        $newContent .= $finalTokens[$i]['content'];
424 406
                         if (PHP_CODESNIFFER_VERBOSITY > 1) {
425
-                            $content = PHP_CodeSniffer::prepareForOutput($finalTokens[$i]['content']);
426
-                            echo "\t\t=> token $i added to URL string and ignored: $content".PHP_EOL;
407
+                            for ($i = ($stackPtr + 1); $i <= $y; $i++) {
408
+                                $type    = $finalTokens[$i]['type'];
409
+                                $content = PHP_CodeSniffer::prepareForOutput($finalTokens[$i]['content']);
410
+                                echo "\tProcess token $i: $type => $content".PHP_EOL;
411
+                            }
412
+
413
+                            echo "\t\t* token starts a URL *".PHP_EOL;
427 414
                         }
428 415
 
429
-                        unset($finalTokens[$i]);
430
-                    }
416
+                        // Join all the content together inside the url() statement.
417
+                        $newContent = '';
418
+                        for ($i = ($x + 2); $i < $numTokens; $i++) {
419
+                            if ($finalTokens[$i]['code'] === T_CLOSE_PARENTHESIS) {
420
+                                break;
421
+                            }
431 422
 
432
-                    $stackPtr = $i;
423
+                            $newContent .= $finalTokens[$i]['content'];
424
+                            if (PHP_CODESNIFFER_VERBOSITY > 1) {
425
+                                $content = PHP_CodeSniffer::prepareForOutput($finalTokens[$i]['content']);
426
+                                echo "\t\t=> token $i added to URL string and ignored: $content".PHP_EOL;
427
+                            }
433 428
 
434
-                    // If the content inside the "url()" is in double quotes
435
-                    // there will only be one token and so we don't have to do
436
-                    // anything except change its type. If it is not empty,
437
-                    // we need to do some token merging.
438
-                    $finalTokens[($x + 1)]['type'] = 'T_URL';
439
-                    $finalTokens[($x + 1)]['code'] = T_URL;
429
+                            unset($finalTokens[$i]);
430
+                        }
440 431
 
441
-                    if ($newContent !== '') {
442
-                        $finalTokens[($x + 1)]['content'] .= $newContent;
443
-                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
444
-                            $content = PHP_CodeSniffer::prepareForOutput($finalTokens[($x + 1)]['content']);
445
-                            echo "\t\t=> token content changed to: $content".PHP_EOL;
432
+                        $stackPtr = $i;
433
+
434
+                        // If the content inside the "url()" is in double quotes
435
+                        // there will only be one token and so we don't have to do
436
+                        // anything except change its type. If it is not empty,
437
+                        // we need to do some token merging.
438
+                        $finalTokens[($x + 1)]['type'] = 'T_URL';
439
+                        $finalTokens[($x + 1)]['code'] = T_URL;
440
+
441
+                        if ($newContent !== '') {
442
+                            $finalTokens[($x + 1)]['content'] .= $newContent;
443
+                            if (PHP_CODESNIFFER_VERBOSITY > 1) {
444
+                                $content = PHP_CodeSniffer::prepareForOutput($finalTokens[($x + 1)]['content']);
445
+                                echo "\t\t=> token content changed to: $content".PHP_EOL;
446
+                            }
446 447
                         }
447
-                    }
448
-                }//end if
448
+                    }//end if
449 449
 
450
-                break;
451
-            case T_ASPERAND:
452
-                $asperandStart = true;
453
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
454
-                    echo "\t\t* at-rule definition opened *".PHP_EOL;
455
-                }
456
-                break;
457
-            default:
458
-                // Nothing special to be done with this token.
459
-                break;
450
+                    break;
451
+                case T_ASPERAND:
452
+                    $asperandStart = true;
453
+                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
454
+                        echo "\t\t* at-rule definition opened *".PHP_EOL;
455
+                    }
456
+                    break;
457
+                default:
458
+                    // Nothing special to be done with this token.
459
+                    break;
460 460
             }//end switch
461 461
         }//end for
462 462
 
Please login to merge, or discard this patch.
CodeSniffer/Tokenizers/PHP.php 1 patch
Switch Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -1450,24 +1450,24 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
         if ($token[0] === T_STRING) {
1452 1452
             switch ($cacheKey) {
1453
-            case 'false':
1454
-                $newToken['type'] = 'T_FALSE';
1455
-                break;
1456
-            case 'true':
1457
-                $newToken['type'] = 'T_TRUE';
1458
-                break;
1459
-            case 'null':
1460
-                $newToken['type'] = 'T_NULL';
1461
-                break;
1462
-            case 'self':
1463
-                $newToken['type'] = 'T_SELF';
1464
-                break;
1465
-            case 'parent':
1466
-                $newToken['type'] = 'T_PARENT';
1467
-                break;
1468
-            default:
1469
-                $newToken['type'] = 'T_STRING';
1470
-                break;
1453
+                case 'false':
1454
+                    $newToken['type'] = 'T_FALSE';
1455
+                    break;
1456
+                case 'true':
1457
+                    $newToken['type'] = 'T_TRUE';
1458
+                    break;
1459
+                case 'null':
1460
+                    $newToken['type'] = 'T_NULL';
1461
+                    break;
1462
+                case 'self':
1463
+                    $newToken['type'] = 'T_SELF';
1464
+                    break;
1465
+                case 'parent':
1466
+                    $newToken['type'] = 'T_PARENT';
1467
+                    break;
1468
+                default:
1469
+                    $newToken['type'] = 'T_STRING';
1470
+                    break;
1471 1471
             }
1472 1472
 
1473 1473
             $newToken['code'] = constant($newToken['type']);
@@ -1509,87 +1509,87 @@  discard block
 block discarded – undo
1509 1509
         $newToken = array();
1510 1510
 
1511 1511
         switch ($token) {
1512
-        case '{':
1513
-            $newToken['type'] = 'T_OPEN_CURLY_BRACKET';
1514
-            break;
1515
-        case '}':
1516
-            $newToken['type'] = 'T_CLOSE_CURLY_BRACKET';
1517
-            break;
1518
-        case '[':
1519
-            $newToken['type'] = 'T_OPEN_SQUARE_BRACKET';
1520
-            break;
1521
-        case ']':
1522
-            $newToken['type'] = 'T_CLOSE_SQUARE_BRACKET';
1523
-            break;
1524
-        case '(':
1525
-            $newToken['type'] = 'T_OPEN_PARENTHESIS';
1526
-            break;
1527
-        case ')':
1528
-            $newToken['type'] = 'T_CLOSE_PARENTHESIS';
1529
-            break;
1530
-        case ':':
1531
-            $newToken['type'] = 'T_COLON';
1532
-            break;
1533
-        case '.':
1534
-            $newToken['type'] = 'T_STRING_CONCAT';
1535
-            break;
1536
-        case '?':
1537
-            $newToken['type'] = 'T_INLINE_THEN';
1538
-            break;
1539
-        case ';':
1540
-            $newToken['type'] = 'T_SEMICOLON';
1541
-            break;
1542
-        case '=':
1543
-            $newToken['type'] = 'T_EQUAL';
1544
-            break;
1545
-        case '*':
1546
-            $newToken['type'] = 'T_MULTIPLY';
1547
-            break;
1548
-        case '/':
1549
-            $newToken['type'] = 'T_DIVIDE';
1550
-            break;
1551
-        case '+':
1552
-            $newToken['type'] = 'T_PLUS';
1553
-            break;
1554
-        case '-':
1555
-            $newToken['type'] = 'T_MINUS';
1556
-            break;
1557
-        case '%':
1558
-            $newToken['type'] = 'T_MODULUS';
1559
-            break;
1560
-        case '^':
1561
-            $newToken['type'] = 'T_BITWISE_XOR';
1562
-            break;
1563
-        case '&':
1564
-            $newToken['type'] = 'T_BITWISE_AND';
1565
-            break;
1566
-        case '|':
1567
-            $newToken['type'] = 'T_BITWISE_OR';
1568
-            break;
1569
-        case '<':
1570
-            $newToken['type'] = 'T_LESS_THAN';
1571
-            break;
1572
-        case '>':
1573
-            $newToken['type'] = 'T_GREATER_THAN';
1574
-            break;
1575
-        case '!':
1576
-            $newToken['type'] = 'T_BOOLEAN_NOT';
1577
-            break;
1578
-        case ',':
1579
-            $newToken['type'] = 'T_COMMA';
1580
-            break;
1581
-        case '@':
1582
-            $newToken['type'] = 'T_ASPERAND';
1583
-            break;
1584
-        case '$':
1585
-            $newToken['type'] = 'T_DOLLAR';
1586
-            break;
1587
-        case '`':
1588
-            $newToken['type'] = 'T_BACKTICK';
1589
-            break;
1590
-        default:
1591
-            $newToken['type'] = 'T_NONE';
1592
-            break;
1512
+            case '{':
1513
+                $newToken['type'] = 'T_OPEN_CURLY_BRACKET';
1514
+                break;
1515
+            case '}':
1516
+                $newToken['type'] = 'T_CLOSE_CURLY_BRACKET';
1517
+                break;
1518
+            case '[':
1519
+                $newToken['type'] = 'T_OPEN_SQUARE_BRACKET';
1520
+                break;
1521
+            case ']':
1522
+                $newToken['type'] = 'T_CLOSE_SQUARE_BRACKET';
1523
+                break;
1524
+            case '(':
1525
+                $newToken['type'] = 'T_OPEN_PARENTHESIS';
1526
+                break;
1527
+            case ')':
1528
+                $newToken['type'] = 'T_CLOSE_PARENTHESIS';
1529
+                break;
1530
+            case ':':
1531
+                $newToken['type'] = 'T_COLON';
1532
+                break;
1533
+            case '.':
1534
+                $newToken['type'] = 'T_STRING_CONCAT';
1535
+                break;
1536
+            case '?':
1537
+                $newToken['type'] = 'T_INLINE_THEN';
1538
+                break;
1539
+            case ';':
1540
+                $newToken['type'] = 'T_SEMICOLON';
1541
+                break;
1542
+            case '=':
1543
+                $newToken['type'] = 'T_EQUAL';
1544
+                break;
1545
+            case '*':
1546
+                $newToken['type'] = 'T_MULTIPLY';
1547
+                break;
1548
+            case '/':
1549
+                $newToken['type'] = 'T_DIVIDE';
1550
+                break;
1551
+            case '+':
1552
+                $newToken['type'] = 'T_PLUS';
1553
+                break;
1554
+            case '-':
1555
+                $newToken['type'] = 'T_MINUS';
1556
+                break;
1557
+            case '%':
1558
+                $newToken['type'] = 'T_MODULUS';
1559
+                break;
1560
+            case '^':
1561
+                $newToken['type'] = 'T_BITWISE_XOR';
1562
+                break;
1563
+            case '&':
1564
+                $newToken['type'] = 'T_BITWISE_AND';
1565
+                break;
1566
+            case '|':
1567
+                $newToken['type'] = 'T_BITWISE_OR';
1568
+                break;
1569
+            case '<':
1570
+                $newToken['type'] = 'T_LESS_THAN';
1571
+                break;
1572
+            case '>':
1573
+                $newToken['type'] = 'T_GREATER_THAN';
1574
+                break;
1575
+            case '!':
1576
+                $newToken['type'] = 'T_BOOLEAN_NOT';
1577
+                break;
1578
+            case ',':
1579
+                $newToken['type'] = 'T_COMMA';
1580
+                break;
1581
+            case '@':
1582
+                $newToken['type'] = 'T_ASPERAND';
1583
+                break;
1584
+            case '$':
1585
+                $newToken['type'] = 'T_DOLLAR';
1586
+                break;
1587
+            case '`':
1588
+                $newToken['type'] = 'T_BACKTICK';
1589
+                break;
1590
+            default:
1591
+                $newToken['type'] = 'T_NONE';
1592
+                break;
1593 1593
         }//end switch
1594 1594
 
1595 1595
         $newToken['code']    = constant($newToken['type']);
Please login to merge, or discard this patch.
CodeSniffer/Fixer.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -283,14 +283,14 @@
 block discarded – undo
283 283
         foreach ($diffLines as $line) {
284 284
             if (isset($line[0]) === true) {
285 285
                 switch ($line[0]) {
286
-                case '-':
287
-                    $diff[] = "\033[31m$line\033[0m";
288
-                    break;
289
-                case '+':
290
-                    $diff[] = "\033[32m$line\033[0m";
291
-                    break;
292
-                default:
293
-                    $diff[] = $line;
286
+                    case '-':
287
+                        $diff[] = "\033[31m$line\033[0m";
288
+                        break;
289
+                    case '+':
290
+                        $diff[] = "\033[32m$line\033[0m";
291
+                        break;
292
+                    default:
293
+                        $diff[] = $line;
294 294
                 }
295 295
             }
296 296
         }
Please login to merge, or discard this patch.
CodeSniffer/File.php 1 patch
Switch Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -1704,60 +1704,60 @@  discard block
 block discarded – undo
1704 1704
             */
1705 1705
 
1706 1706
             switch ($tokens[$i]['code']) {
1707
-            case T_OPEN_SQUARE_BRACKET:
1708
-                $squareOpeners[] = $i;
1709
-
1710
-                if (PHP_CODESNIFFER_VERBOSITY > 1) {
1711
-                    echo str_repeat("\t", count($squareOpeners));
1712
-                    echo str_repeat("\t", count($curlyOpeners));
1713
-                    echo "=> Found square bracket opener at $i".PHP_EOL;
1714
-                }
1715
-                break;
1716
-            case T_OPEN_CURLY_BRACKET:
1717
-                if (isset($tokens[$i]['scope_closer']) === false) {
1718
-                    $curlyOpeners[] = $i;
1707
+                case T_OPEN_SQUARE_BRACKET:
1708
+                    $squareOpeners[] = $i;
1719 1709
 
1720 1710
                     if (PHP_CODESNIFFER_VERBOSITY > 1) {
1721 1711
                         echo str_repeat("\t", count($squareOpeners));
1722 1712
                         echo str_repeat("\t", count($curlyOpeners));
1723
-                        echo "=> Found curly bracket opener at $i".PHP_EOL;
1713
+                        echo "=> Found square bracket opener at $i".PHP_EOL;
1724 1714
                     }
1725
-                }
1726
-                break;
1727
-            case T_CLOSE_SQUARE_BRACKET:
1728
-                if (empty($squareOpeners) === false) {
1729
-                    $opener = array_pop($squareOpeners);
1730
-                    $tokens[$i]['bracket_opener']      = $opener;
1731
-                    $tokens[$i]['bracket_closer']      = $i;
1732
-                    $tokens[$opener]['bracket_opener'] = $opener;
1733
-                    $tokens[$opener]['bracket_closer'] = $i;
1715
+                    break;
1716
+                case T_OPEN_CURLY_BRACKET:
1717
+                    if (isset($tokens[$i]['scope_closer']) === false) {
1718
+                        $curlyOpeners[] = $i;
1734 1719
 
1735
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
1736
-                        echo str_repeat("\t", count($squareOpeners));
1737
-                        echo str_repeat("\t", count($curlyOpeners));
1738
-                        echo "\t=> Found square bracket closer at $i for $opener".PHP_EOL;
1720
+                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1721
+                            echo str_repeat("\t", count($squareOpeners));
1722
+                            echo str_repeat("\t", count($curlyOpeners));
1723
+                            echo "=> Found curly bracket opener at $i".PHP_EOL;
1724
+                        }
1739 1725
                     }
1740
-                }
1741
-                break;
1742
-            case T_CLOSE_CURLY_BRACKET:
1743
-                if (empty($curlyOpeners) === false
1744
-                    && isset($tokens[$i]['scope_opener']) === false
1745
-                ) {
1746
-                    $opener = array_pop($curlyOpeners);
1747
-                    $tokens[$i]['bracket_opener']      = $opener;
1748
-                    $tokens[$i]['bracket_closer']      = $i;
1749
-                    $tokens[$opener]['bracket_opener'] = $opener;
1750
-                    $tokens[$opener]['bracket_closer'] = $i;
1726
+                    break;
1727
+                case T_CLOSE_SQUARE_BRACKET:
1728
+                    if (empty($squareOpeners) === false) {
1729
+                        $opener = array_pop($squareOpeners);
1730
+                        $tokens[$i]['bracket_opener']      = $opener;
1731
+                        $tokens[$i]['bracket_closer']      = $i;
1732
+                        $tokens[$opener]['bracket_opener'] = $opener;
1733
+                        $tokens[$opener]['bracket_closer'] = $i;
1751 1734
 
1752
-                    if (PHP_CODESNIFFER_VERBOSITY > 1) {
1753
-                        echo str_repeat("\t", count($squareOpeners));
1754
-                        echo str_repeat("\t", count($curlyOpeners));
1755
-                        echo "\t=> Found curly bracket closer at $i for $opener".PHP_EOL;
1735
+                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1736
+                            echo str_repeat("\t", count($squareOpeners));
1737
+                            echo str_repeat("\t", count($curlyOpeners));
1738
+                            echo "\t=> Found square bracket closer at $i for $opener".PHP_EOL;
1739
+                        }
1756 1740
                     }
1757
-                }
1758
-                break;
1759
-            default:
1760
-                continue;
1741
+                    break;
1742
+                case T_CLOSE_CURLY_BRACKET:
1743
+                    if (empty($curlyOpeners) === false
1744
+                        && isset($tokens[$i]['scope_opener']) === false
1745
+                    ) {
1746
+                        $opener = array_pop($curlyOpeners);
1747
+                        $tokens[$i]['bracket_opener']      = $opener;
1748
+                        $tokens[$i]['bracket_closer']      = $i;
1749
+                        $tokens[$opener]['bracket_opener'] = $opener;
1750
+                        $tokens[$opener]['bracket_closer'] = $i;
1751
+
1752
+                        if (PHP_CODESNIFFER_VERBOSITY > 1) {
1753
+                            echo str_repeat("\t", count($squareOpeners));
1754
+                            echo str_repeat("\t", count($curlyOpeners));
1755
+                            echo "\t=> Found curly bracket closer at $i for $opener".PHP_EOL;
1756
+                        }
1757
+                    }
1758
+                    break;
1759
+                default:
1760
+                    continue;
1761 1761
             }//end switch
1762 1762
         }//end for
1763 1763
 
@@ -2787,88 +2787,88 @@  discard block
 block discarded – undo
2787 2787
             }
2788 2788
 
2789 2789
             switch ($this->_tokens[$i]['code']) {
2790
-            case T_BITWISE_AND:
2791
-                $passByReference = true;
2792
-                break;
2793
-            case T_VARIABLE:
2794
-                $currVar = $i;
2795
-                break;
2796
-            case T_ELLIPSIS:
2797
-                $variableLength = true;
2798
-                break;
2799
-            case T_ARRAY_HINT:
2800
-            case T_CALLABLE:
2801
-                $typeHint = $this->_tokens[$i]['content'];
2802
-                break;
2803
-            case T_STRING:
2804
-                // This is a string, so it may be a type hint, but it could
2805
-                // also be a constant used as a default value.
2806
-                $prevComma = false;
2807
-                for ($t = $i; $t >= $opener; $t--) {
2808
-                    if ($this->_tokens[$t]['code'] === T_COMMA) {
2809
-                        $prevComma = $t;
2810
-                        break;
2790
+                case T_BITWISE_AND:
2791
+                    $passByReference = true;
2792
+                    break;
2793
+                case T_VARIABLE:
2794
+                    $currVar = $i;
2795
+                    break;
2796
+                case T_ELLIPSIS:
2797
+                    $variableLength = true;
2798
+                    break;
2799
+                case T_ARRAY_HINT:
2800
+                case T_CALLABLE:
2801
+                    $typeHint = $this->_tokens[$i]['content'];
2802
+                    break;
2803
+                case T_STRING:
2804
+                    // This is a string, so it may be a type hint, but it could
2805
+                    // also be a constant used as a default value.
2806
+                    $prevComma = false;
2807
+                    for ($t = $i; $t >= $opener; $t--) {
2808
+                        if ($this->_tokens[$t]['code'] === T_COMMA) {
2809
+                            $prevComma = $t;
2810
+                            break;
2811
+                        }
2811 2812
                     }
2812
-                }
2813 2813
 
2814
-                if ($prevComma !== false) {
2815
-                    $nextEquals = false;
2816
-                    for ($t = $prevComma; $t < $i; $t++) {
2817
-                        if ($this->_tokens[$t]['code'] === T_EQUAL) {
2818
-                            $nextEquals = $t;
2814
+                    if ($prevComma !== false) {
2815
+                        $nextEquals = false;
2816
+                        for ($t = $prevComma; $t < $i; $t++) {
2817
+                            if ($this->_tokens[$t]['code'] === T_EQUAL) {
2818
+                                $nextEquals = $t;
2819
+                                break;
2820
+                            }
2821
+                        }
2822
+
2823
+                        if ($nextEquals !== false) {
2819 2824
                             break;
2820 2825
                         }
2821 2826
                     }
2822 2827
 
2823
-                    if ($nextEquals !== false) {
2824
-                        break;
2828
+                    if ($defaultStart === null) {
2829
+                        $typeHint .= $this->_tokens[$i]['content'];
2830
+                    }
2831
+                    break;
2832
+                case T_NS_SEPARATOR:
2833
+                    // Part of a type hint or default value.
2834
+                    if ($defaultStart === null) {
2835
+                        $typeHint .= $this->_tokens[$i]['content'];
2836
+                    }
2837
+                    break;
2838
+                case T_CLOSE_PARENTHESIS:
2839
+                case T_COMMA:
2840
+                    // If it's null, then there must be no parameters for this
2841
+                    // method.
2842
+                    if ($currVar === null) {
2843
+                        continue;
2825 2844
                     }
2826
-                }
2827
-
2828
-                if ($defaultStart === null) {
2829
-                    $typeHint .= $this->_tokens[$i]['content'];
2830
-                }
2831
-                break;
2832
-            case T_NS_SEPARATOR:
2833
-                // Part of a type hint or default value.
2834
-                if ($defaultStart === null) {
2835
-                    $typeHint .= $this->_tokens[$i]['content'];
2836
-                }
2837
-                break;
2838
-            case T_CLOSE_PARENTHESIS:
2839
-            case T_COMMA:
2840
-                // If it's null, then there must be no parameters for this
2841
-                // method.
2842
-                if ($currVar === null) {
2843
-                    continue;
2844
-                }
2845 2845
 
2846
-                $vars[$paramCount]         = array();
2847
-                $vars[$paramCount]['name'] = $this->_tokens[$currVar]['content'];
2846
+                    $vars[$paramCount]         = array();
2847
+                    $vars[$paramCount]['name'] = $this->_tokens[$currVar]['content'];
2848 2848
 
2849
-                if ($defaultStart !== null) {
2850
-                    $vars[$paramCount]['default']
2851
-                        = $this->getTokensAsString(
2852
-                            $defaultStart,
2853
-                            ($i - $defaultStart)
2854
-                        );
2855
-                }
2849
+                    if ($defaultStart !== null) {
2850
+                        $vars[$paramCount]['default']
2851
+                            = $this->getTokensAsString(
2852
+                                $defaultStart,
2853
+                                ($i - $defaultStart)
2854
+                            );
2855
+                    }
2856 2856
 
2857
-                $vars[$paramCount]['pass_by_reference'] = $passByReference;
2858
-                $vars[$paramCount]['variable_length']   = $variableLength;
2859
-                $vars[$paramCount]['type_hint']         = $typeHint;
2857
+                    $vars[$paramCount]['pass_by_reference'] = $passByReference;
2858
+                    $vars[$paramCount]['variable_length']   = $variableLength;
2859
+                    $vars[$paramCount]['type_hint']         = $typeHint;
2860 2860
 
2861
-                // Reset the vars, as we are about to process the next parameter.
2862
-                $defaultStart    = null;
2863
-                $passByReference = false;
2864
-                $variableLength  = false;
2865
-                $typeHint        = '';
2861
+                    // Reset the vars, as we are about to process the next parameter.
2862
+                    $defaultStart    = null;
2863
+                    $passByReference = false;
2864
+                    $variableLength  = false;
2865
+                    $typeHint        = '';
2866 2866
 
2867
-                $paramCount++;
2868
-                break;
2869
-            case T_EQUAL:
2870
-                $defaultStart = ($i + 1);
2871
-                break;
2867
+                    $paramCount++;
2868
+                    break;
2869
+                case T_EQUAL:
2870
+                    $defaultStart = ($i + 1);
2871
+                    break;
2872 2872
             }//end switch
2873 2873
         }//end for
2874 2874
 
@@ -2930,27 +2930,27 @@  discard block
 block discarded – undo
2930 2930
             }
2931 2931
 
2932 2932
             switch ($this->_tokens[$i]['code']) {
2933
-            case T_PUBLIC:
2934
-                $scope          = 'public';
2935
-                $scopeSpecified = true;
2936
-                break;
2937
-            case T_PRIVATE:
2938
-                $scope          = 'private';
2939
-                $scopeSpecified = true;
2940
-                break;
2941
-            case T_PROTECTED:
2942
-                $scope          = 'protected';
2943
-                $scopeSpecified = true;
2944
-                break;
2945
-            case T_ABSTRACT:
2946
-                $isAbstract = true;
2947
-                break;
2948
-            case T_FINAL:
2949
-                $isFinal = true;
2950
-                break;
2951
-            case T_STATIC:
2952
-                $isStatic = true;
2953
-                break;
2933
+                case T_PUBLIC:
2934
+                    $scope          = 'public';
2935
+                    $scopeSpecified = true;
2936
+                    break;
2937
+                case T_PRIVATE:
2938
+                    $scope          = 'private';
2939
+                    $scopeSpecified = true;
2940
+                    break;
2941
+                case T_PROTECTED:
2942
+                    $scope          = 'protected';
2943
+                    $scopeSpecified = true;
2944
+                    break;
2945
+                case T_ABSTRACT:
2946
+                    $isAbstract = true;
2947
+                    break;
2948
+                case T_FINAL:
2949
+                    $isFinal = true;
2950
+                    break;
2951
+                case T_STATIC:
2952
+                    $isStatic = true;
2953
+                    break;
2954 2954
             }//end switch
2955 2955
         }//end for
2956 2956
 
@@ -3040,21 +3040,21 @@  discard block
 block discarded – undo
3040 3040
             }
3041 3041
 
3042 3042
             switch ($this->_tokens[$i]['code']) {
3043
-            case T_PUBLIC:
3044
-                $scope          = 'public';
3045
-                $scopeSpecified = true;
3046
-                break;
3047
-            case T_PRIVATE:
3048
-                $scope          = 'private';
3049
-                $scopeSpecified = true;
3050
-                break;
3051
-            case T_PROTECTED:
3052
-                $scope          = 'protected';
3053
-                $scopeSpecified = true;
3054
-                break;
3055
-            case T_STATIC:
3056
-                $isStatic = true;
3057
-                break;
3043
+                case T_PUBLIC:
3044
+                    $scope          = 'public';
3045
+                    $scopeSpecified = true;
3046
+                    break;
3047
+                case T_PRIVATE:
3048
+                    $scope          = 'private';
3049
+                    $scopeSpecified = true;
3050
+                    break;
3051
+                case T_PROTECTED:
3052
+                    $scope          = 'protected';
3053
+                    $scopeSpecified = true;
3054
+                    break;
3055
+                case T_STATIC:
3056
+                    $isStatic = true;
3057
+                    break;
3058 3058
             }
3059 3059
         }//end for
3060 3060
 
@@ -3108,13 +3108,13 @@  discard block
 block discarded – undo
3108 3108
             }
3109 3109
 
3110 3110
             switch ($this->_tokens[$i]['code']) {
3111
-            case T_ABSTRACT:
3112
-                $isAbstract = true;
3113
-                break;
3111
+                case T_ABSTRACT:
3112
+                    $isAbstract = true;
3113
+                    break;
3114 3114
 
3115
-            case T_FINAL:
3116
-                $isFinal = true;
3117
-                break;
3115
+                case T_FINAL:
3116
+                    $isFinal = true;
3117
+                    break;
3118 3118
             }
3119 3119
         }//end for
3120 3120
 
Please login to merge, or discard this patch.
CodeSniffer/Standards/PSR2/Sniffs/Methods/MethodDeclarationSniff.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -80,18 +80,18 @@
 block discarded – undo
80 80
         $prefix = $stackPtr;
81 81
         while (($prefix = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$methodPrefixes, ($prefix - 1), $prev)) !== false) {
82 82
             switch ($tokens[$prefix]['code']) {
83
-            case T_STATIC:
84
-                $static = $prefix;
85
-                break;
86
-            case T_ABSTRACT:
87
-                $abstract = $prefix;
88
-                break;
89
-            case T_FINAL:
90
-                $final = $prefix;
91
-                break;
92
-            default:
93
-                $visibility = $prefix;
94
-                break;
83
+                case T_STATIC:
84
+                    $static = $prefix;
85
+                    break;
86
+                case T_ABSTRACT:
87
+                    $abstract = $prefix;
88
+                    break;
89
+                case T_FINAL:
90
+                    $final = $prefix;
91
+                    break;
92
+                default:
93
+                    $visibility = $prefix;
94
+                    break;
95 95
             }
96 96
         }
97 97
 
Please login to merge, or discard this patch.
Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc 1 patch
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 }
35 35
 
36 36
 switch ($foo) {
37
-    case'Foo': {
38
-        echo 'foo';
39
-        break;
40
-        }
37
+        case'Foo': {
38
+            echo 'foo';
39
+            break;
40
+            }
41 41
 }
42 42
 
43 43
 while ($i < 10) {
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 }
53 53
 
54 54
 switch (true) {
55
-    case is_resource($value):
56
-        throw new Exception('foo');
57
-    case is_object($value):
58
-        return 'object';
55
+        case is_resource($value):
56
+            throw new Exception('foo');
57
+        case is_object($value):
58
+            return 'object';
59 59
 }
60 60
 
61 61
 switch (0) {
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 }
106 106
 
107 107
 switch ($foo) {
108
-    case 1: $bar = 1; break;
109
-    case 2:
108
+        case 1: $bar = 1; break;
109
+        case 2:
110 110
     
111
-        $bar = 2; break;
112
-    case 21:
113
-    case 3: return 3;
114
-    default: $bar = 0;
111
+            $bar = 2; break;
112
+        case 21:
113
+        case 3: return 3;
114
+        default: $bar = 0;
115 115
 }
116 116
 
117 117
 switch ($foo) {
Please login to merge, or discard this patch.
CodeSniffer/Standards/PSR2/Tests/Files/EndFileNewlineUnitTest.php 1 patch
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,17 +43,17 @@
 block discarded – undo
43 43
     public function getErrorList($testFile='')
44 44
     {
45 45
         switch ($testFile) {
46
-        case 'EndFileNewlineUnitTest.1.inc':
47
-        case 'EndFileNewlineUnitTest.3.inc':
48
-        case 'EndFileNewlineUnitTest.6.inc':
49
-        case 'EndFileNewlineUnitTest.7.inc':
50
-            return array(
51
-                    2 => 1,
52
-                   );
53
-            break;
54
-        default:
55
-            return array();
56
-            break;
46
+            case 'EndFileNewlineUnitTest.1.inc':
47
+            case 'EndFileNewlineUnitTest.3.inc':
48
+            case 'EndFileNewlineUnitTest.6.inc':
49
+            case 'EndFileNewlineUnitTest.7.inc':
50
+                return array(
51
+                        2 => 1,
52
+                       );
53
+                break;
54
+            default:
55
+                return array();
56
+                break;
57 57
         }//end switch
58 58
 
59 59
     }//end getErrorList()
Please login to merge, or discard this patch.
CodeSniffer/Standards/PSR2/Tests/Files/ClosingTagUnitTest.php 1 patch
Switch Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,15 +43,15 @@
 block discarded – undo
43 43
     public function getErrorList($testFile='')
44 44
     {
45 45
         switch ($testFile) {
46
-        case 'ClosingTagUnitTest.1.inc':
47
-            return array(11 => 1);
46
+            case 'ClosingTagUnitTest.1.inc':
47
+                return array(11 => 1);
48 48
 
49
-        case 'ClosingTagUnitTest.4.inc':
50
-        case 'ClosingTagUnitTest.5.inc':
51
-            return array(1 => 1);
49
+            case 'ClosingTagUnitTest.4.inc':
50
+            case 'ClosingTagUnitTest.5.inc':
51
+                return array(1 => 1);
52 52
 
53
-        default:
54
-            return array();
53
+            default:
54
+                return array();
55 55
         }
56 56
 
57 57
     }//end getErrorList()
Please login to merge, or discard this patch.