Completed
Pull Request — master (#11)
by Tomáš
04:07
created
src/Config.php 1 patch
Switch Indentation   +332 added lines, -332 removed lines patch added patch discarded remove patch
@@ -204,35 +204,35 @@  discard block
 block discarded – undo
204 204
         }
205 205
 
206 206
         switch ($name) {
207
-        case 'reportWidth' :
208
-            // Support auto terminal width.
209
-            if ($value === 'auto' && preg_match('|\d+ (\d+)|', shell_exec('stty size 2>&1'), $matches) === 1) {
210
-                $value = (int) $matches[1];
211
-            } else {
212
-                $value = (int) $value;
213
-            }
214
-            break;
215
-        case 'standards' :
216
-            $cleaned = array();
217
-
218
-            // Check if the standard name is valid, or if the case is invalid.
219
-            $installedStandards = Util\Standards::getInstalledStandards();
220
-            foreach ($value as $standard) {
221
-                foreach ($installedStandards as $validStandard) {
222
-                    if (strtolower($standard) === strtolower($validStandard)) {
223
-                        $standard = $validStandard;
224
-                        break;
225
-                    }
207
+            case 'reportWidth' :
208
+                // Support auto terminal width.
209
+                if ($value === 'auto' && preg_match('|\d+ (\d+)|', shell_exec('stty size 2>&1'), $matches) === 1) {
210
+                    $value = (int) $matches[1];
211
+                } else {
212
+                    $value = (int) $value;
226 213
                 }
214
+                break;
215
+            case 'standards' :
216
+                $cleaned = array();
217
+
218
+                // Check if the standard name is valid, or if the case is invalid.
219
+                $installedStandards = Util\Standards::getInstalledStandards();
220
+                foreach ($value as $standard) {
221
+                    foreach ($installedStandards as $validStandard) {
222
+                        if (strtolower($standard) === strtolower($validStandard)) {
223
+                            $standard = $validStandard;
224
+                            break;
225
+                        }
226
+                    }
227 227
 
228
-                $cleaned[] = $standard;
229
-            }
228
+                    $cleaned[] = $standard;
229
+                }
230 230
 
231
-            $value = $cleaned;
232
-            break;
233
-        default :
234
-            // No validation required.
235
-            break;
231
+                $value = $cleaned;
232
+                break;
233
+            default :
234
+                // No validation required.
235
+                break;
236 236
         }//end switch
237 237
 
238 238
         $this->settings[$name] = $value;
@@ -511,68 +511,68 @@  discard block
 block discarded – undo
511 511
     public function processShortArgument($arg, $pos)
512 512
     {
513 513
         switch ($arg) {
514
-        case 'h':
515
-        case '?':
516
-            $this->printUsage();
517
-            exit(0);
518
-        case 'i' :
519
-            Util\Standards::printInstalledStandards();
520
-            exit(0);
521
-        case 'v' :
522
-            $this->verbosity++;
523
-            $this->overriddenDefaults['verbosity'] = true;
524
-            break;
525
-        case 'l' :
526
-            $this->local = true;
527
-            $this->overriddenDefaults['local'] = true;
528
-            break;
529
-        case 's' :
530
-            $this->showSources = true;
531
-            $this->overriddenDefaults['showSources'] = true;
532
-            break;
533
-        case 'a' :
534
-            $this->interactive = true;
535
-            $this->overriddenDefaults['interactive'] = true;
536
-            break;
537
-        case 'e':
538
-            $this->explain = true;
539
-            $this->overriddenDefaults['explain'] = true;
540
-            break;
541
-        case 'p' :
542
-            $this->showProgress = true;
543
-            $this->overriddenDefaults['showProgress'] = true;
544
-            break;
545
-        case 'm' :
546
-            $this->recordErrors = false;
547
-            $this->overriddenDefaults['recordErrors'] = true;
548
-            break;
549
-        case 'd' :
550
-            $ini = explode('=', $this->cliArgs[($pos + 1)]);
551
-            $this->cliArgs[($pos + 1)] = '';
552
-            if (isset($ini[1]) === true) {
553
-                ini_set($ini[0], $ini[1]);
554
-            } else {
555
-                ini_set($ini[0], true);
556
-            }
557
-            break;
558
-        case 'n' :
559
-            if (isset($this->overriddenDefaults['warningSeverity']) === false) {
560
-                $this->warningSeverity = 0;
561
-                $this->overriddenDefaults['warningSeverity'] = true;
562
-            }
563
-            break;
564
-        case 'w' :
565
-            if (isset($this->overriddenDefaults['warningSeverity']) === false) {
566
-                $this->warningSeverity = $this->errorSeverity;
567
-                $this->overriddenDefaults['warningSeverity'] = true;
568
-            }
569
-            break;
570
-        default:
571
-            if ($this->dieOnUnknownArg === false) {
572
-                $this->values[$arg] = $arg;
573
-            } else {
574
-                $this->processUnknownArgument('-'.$arg, $pos);
575
-            }
514
+            case 'h':
515
+            case '?':
516
+                $this->printUsage();
517
+                exit(0);
518
+            case 'i' :
519
+                Util\Standards::printInstalledStandards();
520
+                exit(0);
521
+            case 'v' :
522
+                $this->verbosity++;
523
+                $this->overriddenDefaults['verbosity'] = true;
524
+                break;
525
+            case 'l' :
526
+                $this->local = true;
527
+                $this->overriddenDefaults['local'] = true;
528
+                break;
529
+            case 's' :
530
+                $this->showSources = true;
531
+                $this->overriddenDefaults['showSources'] = true;
532
+                break;
533
+            case 'a' :
534
+                $this->interactive = true;
535
+                $this->overriddenDefaults['interactive'] = true;
536
+                break;
537
+            case 'e':
538
+                $this->explain = true;
539
+                $this->overriddenDefaults['explain'] = true;
540
+                break;
541
+            case 'p' :
542
+                $this->showProgress = true;
543
+                $this->overriddenDefaults['showProgress'] = true;
544
+                break;
545
+            case 'm' :
546
+                $this->recordErrors = false;
547
+                $this->overriddenDefaults['recordErrors'] = true;
548
+                break;
549
+            case 'd' :
550
+                $ini = explode('=', $this->cliArgs[($pos + 1)]);
551
+                $this->cliArgs[($pos + 1)] = '';
552
+                if (isset($ini[1]) === true) {
553
+                    ini_set($ini[0], $ini[1]);
554
+                } else {
555
+                    ini_set($ini[0], true);
556
+                }
557
+                break;
558
+            case 'n' :
559
+                if (isset($this->overriddenDefaults['warningSeverity']) === false) {
560
+                    $this->warningSeverity = 0;
561
+                    $this->overriddenDefaults['warningSeverity'] = true;
562
+                }
563
+                break;
564
+            case 'w' :
565
+                if (isset($this->overriddenDefaults['warningSeverity']) === false) {
566
+                    $this->warningSeverity = $this->errorSeverity;
567
+                    $this->overriddenDefaults['warningSeverity'] = true;
568
+                }
569
+                break;
570
+            default:
571
+                if ($this->dieOnUnknownArg === false) {
572
+                    $this->values[$arg] = $arg;
573
+                } else {
574
+                    $this->processUnknownArgument('-'.$arg, $pos);
575
+                }
576 576
         }//end switch
577 577
 
578 578
     }//end processShortArgument()
@@ -589,293 +589,293 @@  discard block
 block discarded – undo
589 589
     public function processLongArgument($arg, $pos)
590 590
     {
591 591
         switch ($arg) {
592
-        case 'help':
593
-            $this->printUsage();
594
-            exit(0);
595
-        case 'version':
596
-            echo 'Symplify\PHP7_CodeSniffer version '.self::VERSION.' ('.self::STABILITY.') ';
597
-            echo 'by Squiz (http://www.squiz.net)'.PHP_EOL;
598
-            exit(0);
599
-        case 'colors':
600
-            $this->colors = true;
601
-            $this->overriddenDefaults['colors'] = true;
602
-            break;
603
-        case 'no-colors':
604
-            $this->colors = false;
605
-            $this->overriddenDefaults['colors'] = true;
606
-            break;
607
-        case 'cache':
608
-            if (defined('Symplify\PHP7_CodeSniffer_IN_TESTS') === false) {
609
-                $this->cache = true;
610
-                $this->overriddenDefaults['cache'] = true;
611
-            }
612
-            break;
613
-        case 'no-cache':
614
-            $this->cache = false;
615
-            $this->overriddenDefaults['cache'] = true;
616
-            break;
617
-        case 'config-set':
618
-            if (isset($this->cliArgs[($pos + 1)]) === false
619
-                || isset($this->cliArgs[($pos + 2)]) === false
620
-            ) {
621
-                echo 'ERROR: Setting a config option requires a name and value'.PHP_EOL.PHP_EOL;
592
+            case 'help':
622 593
                 $this->printUsage();
623 594
                 exit(0);
624
-            }
625
-
626
-            $key     = $this->cliArgs[($pos + 1)];
627
-            $value   = $this->cliArgs[($pos + 2)];
628
-            $current = self::getConfigData($key);
629
-
630
-            try {
631
-                $this->setConfigData($key, $value);
632
-            } catch (Exception $e) {
633
-                echo $e->getMessage().PHP_EOL;
634
-                exit(2);
635
-            }
636
-
637
-            if ($current === null) {
638
-                echo "Config value \"$key\" added successfully".PHP_EOL;
639
-            } else {
640
-                echo "Config value \"$key\" updated successfully; old value was \"$current\"".PHP_EOL;
641
-            }
642
-            exit(0);
643
-        case 'config-delete':
644
-            if (isset($this->cliArgs[($pos + 1)]) === false) {
645
-                echo 'ERROR: Deleting a config option requires the name of the option'.PHP_EOL.PHP_EOL;
646
-                $this->printUsage();
595
+            case 'version':
596
+                echo 'Symplify\PHP7_CodeSniffer version '.self::VERSION.' ('.self::STABILITY.') ';
597
+                echo 'by Squiz (http://www.squiz.net)'.PHP_EOL;
647 598
                 exit(0);
648
-            }
599
+            case 'colors':
600
+                $this->colors = true;
601
+                $this->overriddenDefaults['colors'] = true;
602
+                break;
603
+            case 'no-colors':
604
+                $this->colors = false;
605
+                $this->overriddenDefaults['colors'] = true;
606
+                break;
607
+            case 'cache':
608
+                if (defined('Symplify\PHP7_CodeSniffer_IN_TESTS') === false) {
609
+                    $this->cache = true;
610
+                    $this->overriddenDefaults['cache'] = true;
611
+                }
612
+                break;
613
+            case 'no-cache':
614
+                $this->cache = false;
615
+                $this->overriddenDefaults['cache'] = true;
616
+                break;
617
+            case 'config-set':
618
+                if (isset($this->cliArgs[($pos + 1)]) === false
619
+                    || isset($this->cliArgs[($pos + 2)]) === false
620
+                ) {
621
+                    echo 'ERROR: Setting a config option requires a name and value'.PHP_EOL.PHP_EOL;
622
+                    $this->printUsage();
623
+                    exit(0);
624
+                }
625
+
626
+                $key     = $this->cliArgs[($pos + 1)];
627
+                $value   = $this->cliArgs[($pos + 2)];
628
+                $current = self::getConfigData($key);
649 629
 
650
-            $key     = $this->cliArgs[($pos + 1)];
651
-            $current = self::getConfigData($key);
652
-            if ($current === null) {
653
-                echo "Config value \"$key\" has not been set".PHP_EOL;
654
-            } else {
655 630
                 try {
656
-                    $this->setConfigData($key, null);
631
+                    $this->setConfigData($key, $value);
657 632
                 } catch (Exception $e) {
658 633
                     echo $e->getMessage().PHP_EOL;
659 634
                     exit(2);
660 635
                 }
661 636
 
662
-                echo "Config value \"$key\" removed successfully; old value was \"$current\"".PHP_EOL;
663
-            }
664
-            exit(0);
665
-        case 'config-show':
666
-            $data = self::getAllConfigData();
667
-            $this->printConfigData($data);
668
-            exit(0);
669
-        case 'runtime-set':
670
-            if (isset($this->cliArgs[($pos + 1)]) === false
671
-                || isset($this->cliArgs[($pos + 2)]) === false
672
-            ) {
673
-                echo 'ERROR: Setting a runtime config option requires a name and value'.PHP_EOL.PHP_EOL;
674
-                $this->printUsage();
637
+                if ($current === null) {
638
+                    echo "Config value \"$key\" added successfully".PHP_EOL;
639
+                } else {
640
+                    echo "Config value \"$key\" updated successfully; old value was \"$current\"".PHP_EOL;
641
+                }
675 642
                 exit(0);
676
-            }
643
+            case 'config-delete':
644
+                if (isset($this->cliArgs[($pos + 1)]) === false) {
645
+                    echo 'ERROR: Deleting a config option requires the name of the option'.PHP_EOL.PHP_EOL;
646
+                    $this->printUsage();
647
+                    exit(0);
648
+                }
677 649
 
678
-            $key   = $this->cliArgs[($pos + 1)];
679
-            $value = $this->cliArgs[($pos + 2)];
680
-            $this->cliArgs[($pos + 1)] = '';
681
-            $this->cliArgs[($pos + 2)] = '';
682
-            self::setConfigData($key, $value, true);
683
-            break;
684
-        default:
685
-            if (substr($arg, 0, 7) === 'sniffs=') {
686
-                $sniffs = explode(',', substr($arg, 7));
687
-                foreach ($sniffs as $sniff) {
688
-                    if (substr_count($sniff, '.') !== 2) {
689
-                        echo 'ERROR: The specified sniff code "'.$sniff.'" is invalid'.PHP_EOL.PHP_EOL;
690
-                        $this->printUsage();
650
+                $key     = $this->cliArgs[($pos + 1)];
651
+                $current = self::getConfigData($key);
652
+                if ($current === null) {
653
+                    echo "Config value \"$key\" has not been set".PHP_EOL;
654
+                } else {
655
+                    try {
656
+                        $this->setConfigData($key, null);
657
+                    } catch (Exception $e) {
658
+                        echo $e->getMessage().PHP_EOL;
691 659
                         exit(2);
692 660
                     }
661
+
662
+                    echo "Config value \"$key\" removed successfully; old value was \"$current\"".PHP_EOL;
663
+                }
664
+                exit(0);
665
+            case 'config-show':
666
+                $data = self::getAllConfigData();
667
+                $this->printConfigData($data);
668
+                exit(0);
669
+            case 'runtime-set':
670
+                if (isset($this->cliArgs[($pos + 1)]) === false
671
+                    || isset($this->cliArgs[($pos + 2)]) === false
672
+                ) {
673
+                    echo 'ERROR: Setting a runtime config option requires a name and value'.PHP_EOL.PHP_EOL;
674
+                    $this->printUsage();
675
+                    exit(0);
693 676
                 }
694 677
 
695
-                $this->sniffs = $sniffs;
696
-                $this->overriddenDefaults['sniffs'] = true;
697
-            } else if (defined('Symplify\PHP7_CodeSniffer_IN_TESTS') === false
698
-                && substr($arg, 0, 6) === 'cache='
699
-            ) {
700
-                // Turn caching on.
701
-                $this->cache = true;
702
-                $this->overriddenDefaults['cache'] = true;
678
+                $key   = $this->cliArgs[($pos + 1)];
679
+                $value = $this->cliArgs[($pos + 2)];
680
+                $this->cliArgs[($pos + 1)] = '';
681
+                $this->cliArgs[($pos + 2)] = '';
682
+                self::setConfigData($key, $value, true);
683
+                break;
684
+            default:
685
+                if (substr($arg, 0, 7) === 'sniffs=') {
686
+                    $sniffs = explode(',', substr($arg, 7));
687
+                    foreach ($sniffs as $sniff) {
688
+                        if (substr_count($sniff, '.') !== 2) {
689
+                            echo 'ERROR: The specified sniff code "'.$sniff.'" is invalid'.PHP_EOL.PHP_EOL;
690
+                            $this->printUsage();
691
+                            exit(2);
692
+                        }
693
+                    }
703 694
 
704
-                $this->cacheFile = Util\Common::realpath(substr($arg, 6));
695
+                    $this->sniffs = $sniffs;
696
+                    $this->overriddenDefaults['sniffs'] = true;
697
+                } else if (defined('Symplify\PHP7_CodeSniffer_IN_TESTS') === false
698
+                    && substr($arg, 0, 6) === 'cache='
699
+                ) {
700
+                    // Turn caching on.
701
+                    $this->cache = true;
702
+                    $this->overriddenDefaults['cache'] = true;
703
+
704
+                    $this->cacheFile = Util\Common::realpath(substr($arg, 6));
705
+
706
+                    // It may not exist and return false instead.
707
+                    if ($this->cacheFile === false) {
708
+                        $this->cacheFile = substr($arg, 6);
709
+
710
+                        $dir = dirname($this->cacheFile);
711
+                        if (is_dir($dir) === false) {
712
+                            echo 'ERROR: The specified cache file path "'.$this->cacheFile.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
713
+                            $this->printUsage();
714
+                            exit(2);
715
+                        }
705 716
 
706
-                // It may not exist and return false instead.
707
-                if ($this->cacheFile === false) {
708
-                    $this->cacheFile = substr($arg, 6);
717
+                        if ($dir === '.') {
718
+                            // Passed report file is a file in the current directory.
719
+                            $this->cacheFile = getcwd().'/'.basename($this->cacheFile);
720
+                        } else {
721
+                            $dir = Util\Common::realpath(getcwd().'/'.$dir);
722
+                            if ($dir !== false) {
723
+                                // Report file path is relative.
724
+                                $this->cacheFile = $dir.'/'.basename($this->cacheFile);
725
+                            }
726
+                        }
727
+                    }//end if
728
+
729
+                    $this->overriddenDefaults['cacheFile'] = true;
709 730
 
710
-                    $dir = dirname($this->cacheFile);
711
-                    if (is_dir($dir) === false) {
712
-                        echo 'ERROR: The specified cache file path "'.$this->cacheFile.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
731
+                    if (is_dir($this->cacheFile) === true) {
732
+                        echo 'ERROR: The specified cache file path "'.$this->cacheFile.'" is a directory'.PHP_EOL.PHP_EOL;
713 733
                         $this->printUsage();
714 734
                         exit(2);
715 735
                     }
716
-
717
-                    if ($dir === '.') {
718
-                        // Passed report file is a file in the current directory.
719
-                        $this->cacheFile = getcwd().'/'.basename($this->cacheFile);
720
-                    } else {
721
-                        $dir = Util\Common::realpath(getcwd().'/'.$dir);
722
-                        if ($dir !== false) {
723
-                            // Report file path is relative.
724
-                            $this->cacheFile = $dir.'/'.basename($this->cacheFile);
736
+                } else if (substr($arg, 0, 10) === 'bootstrap=') {
737
+                    $files     = explode(',', substr($arg, 10));
738
+                    $bootstrap = array();
739
+                    foreach ($files as $file) {
740
+                        $path = Util\Common::realpath($file);
741
+                        if ($path === false) {
742
+                            echo 'ERROR: The specified bootstrap file "'.$file.'" does not exist'.PHP_EOL.PHP_EOL;
743
+                            $this->printUsage();
744
+                            exit(2);
725 745
                         }
726
-                    }
727
-                }//end if
728
-
729
-                $this->overriddenDefaults['cacheFile'] = true;
730 746
 
731
-                if (is_dir($this->cacheFile) === true) {
732
-                    echo 'ERROR: The specified cache file path "'.$this->cacheFile.'" is a directory'.PHP_EOL.PHP_EOL;
733
-                    $this->printUsage();
734
-                    exit(2);
735
-                }
736
-            } else if (substr($arg, 0, 10) === 'bootstrap=') {
737
-                $files     = explode(',', substr($arg, 10));
738
-                $bootstrap = array();
739
-                foreach ($files as $file) {
740
-                    $path = Util\Common::realpath($file);
741
-                    if ($path === false) {
742
-                        echo 'ERROR: The specified bootstrap file "'.$file.'" does not exist'.PHP_EOL.PHP_EOL;
743
-                        $this->printUsage();
744
-                        exit(2);
747
+                        $bootstrap[] = $path;
745 748
                     }
746 749
 
747
-                    $bootstrap[] = $path;
748
-                }
750
+                    $this->bootstrap = array_merge($this->bootstrap, $bootstrap);
751
+                    $this->overriddenDefaults['bootstrap'] = true;
752
+                } else if (substr($arg, 0, 11) === 'stdin-path=') {
753
+                    $this->stdinPath = Util\Common::realpath(substr($arg, 11));
749 754
 
750
-                $this->bootstrap = array_merge($this->bootstrap, $bootstrap);
751
-                $this->overriddenDefaults['bootstrap'] = true;
752
-            } else if (substr($arg, 0, 11) === 'stdin-path=') {
753
-                $this->stdinPath = Util\Common::realpath(substr($arg, 11));
755
+                    // It may not exist and return false instead, so use whatever they gave us.
756
+                    if ($this->stdinPath === false) {
757
+                        $this->stdinPath = trim(substr($arg, 11));
758
+                    }
754 759
 
755
-                // It may not exist and return false instead, so use whatever they gave us.
756
-                if ($this->stdinPath === false) {
757
-                    $this->stdinPath = trim(substr($arg, 11));
758
-                }
760
+                    $this->overriddenDefaults['stdinPath'] = true;
761
+                } else if (substr($arg, 0, 9) === 'basepath=') {
762
+                    if (isset($this->overriddenDefaults['basepath']) === true) {
763
+                        break;
764
+                    }
759 765
 
760
-                $this->overriddenDefaults['stdinPath'] = true;
761
-            } else if (substr($arg, 0, 9) === 'basepath=') {
762
-                if (isset($this->overriddenDefaults['basepath']) === true) {
763
-                    break;
764
-                }
766
+                    $this->basepath = Util\Common::realpath(substr($arg, 9));
765 767
 
766
-                $this->basepath = Util\Common::realpath(substr($arg, 9));
768
+                    // It may not exist and return false instead.
769
+                    if ($this->basepath === false) {
770
+                        $this->basepath = substr($arg, 9);
771
+                    }
767 772
 
768
-                // It may not exist and return false instead.
769
-                if ($this->basepath === false) {
770
-                    $this->basepath = substr($arg, 9);
771
-                }
773
+                    $this->overriddenDefaults['basepath'] = true;
772 774
 
773
-                $this->overriddenDefaults['basepath'] = true;
775
+                    if (is_dir($this->basepath) === false) {
776
+                        echo 'ERROR: The specified basepath "'.$this->basepath.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
777
+                        $this->printUsage();
778
+                        exit(2);
779
+                    }
780
+                } else if (substr($arg, 0, 7) === 'filter=') {
781
+                    if (isset($this->overriddenDefaults['filter']) === true) {
782
+                        break;
783
+                    }
774 784
 
775
-                if (is_dir($this->basepath) === false) {
776
-                    echo 'ERROR: The specified basepath "'.$this->basepath.'" points to a non-existent directory'.PHP_EOL.PHP_EOL;
777
-                    $this->printUsage();
778
-                    exit(2);
779
-                }
780
-            } else if (substr($arg, 0, 7) === 'filter=') {
781
-                if (isset($this->overriddenDefaults['filter']) === true) {
782
-                    break;
783
-                }
785
+                    $this->filter = substr($arg, 7);
786
+                    $this->overriddenDefaults['filter'] = true;
787
+                } else if (substr($arg, 0, 9) === 'standard=') {
788
+                    $standards = trim(substr($arg, 9));
789
+                    if ($standards !== '') {
790
+                        $this->standards = explode(',', $standards);
791
+                    }
784 792
 
785
-                $this->filter = substr($arg, 7);
786
-                $this->overriddenDefaults['filter'] = true;
787
-            } else if (substr($arg, 0, 9) === 'standard=') {
788
-                $standards = trim(substr($arg, 9));
789
-                if ($standards !== '') {
790
-                    $this->standards = explode(',', $standards);
791
-                }
793
+                    $this->overriddenDefaults['standards'] = true;
794
+                } else if (substr($arg, 0, 11) === 'extensions=') {
795
+                    $extensions    = explode(',', substr($arg, 11));
796
+                    $newExtensions = array();
797
+                    foreach ($extensions as $ext) {
798
+                        $slash = strpos($ext, '/');
799
+                        if ($slash !== false) {
800
+                            // They specified the tokenizer too.
801
+                            list($ext, $tokenizer) = explode('/', $ext);
802
+                            $newExtensions[$ext]   = strtoupper($tokenizer);
803
+                            continue;
804
+                        }
792 805
 
793
-                $this->overriddenDefaults['standards'] = true;
794
-            } else if (substr($arg, 0, 11) === 'extensions=') {
795
-                $extensions    = explode(',', substr($arg, 11));
796
-                $newExtensions = array();
797
-                foreach ($extensions as $ext) {
798
-                    $slash = strpos($ext, '/');
799
-                    if ($slash !== false) {
800
-                        // They specified the tokenizer too.
801
-                        list($ext, $tokenizer) = explode('/', $ext);
802
-                        $newExtensions[$ext]   = strtoupper($tokenizer);
803
-                        continue;
806
+                        if (isset($this->extensions[$ext]) === true) {
807
+                            $newExtensions[$ext] = $this->extensions[$ext];
808
+                        } else {
809
+                            $newExtensions[$ext] = 'PHP';
810
+                        }
804 811
                     }
805 812
 
806
-                    if (isset($this->extensions[$ext]) === true) {
807
-                        $newExtensions[$ext] = $this->extensions[$ext];
808
-                    } else {
809
-                        $newExtensions[$ext] = 'PHP';
810
-                    }
811
-                }
813
+                    $this->extensions = $newExtensions;
814
+                    $this->overriddenDefaults['extensions'] = true;
815
+                } else if (substr($arg, 0, 7) === 'suffix=') {
816
+                    $this->suffix = explode(',', substr($arg, 7));
817
+                    $this->overriddenDefaults['suffix'] = true;
818
+                } else if (substr($arg, 0, 9) === 'parallel=') {
819
+                    $this->parallel = max((int) substr($arg, 9), 1);
820
+                    $this->overriddenDefaults['parallel'] = true;
821
+                } else if (substr($arg, 0, 9) === 'severity=') {
822
+                    $this->errorSeverity   = (int) substr($arg, 9);
823
+                    $this->warningSeverity = $this->errorSeverity;
824
+                    $this->overriddenDefaults['errorSeverity']   = true;
825
+                    $this->overriddenDefaults['warningSeverity'] = true;
826
+                } else if (substr($arg, 0, 15) === 'error-severity=') {
827
+                    $this->errorSeverity = (int) substr($arg, 15);
828
+                    $this->overriddenDefaults['errorSeverity'] = true;
829
+                } else if (substr($arg, 0, 17) === 'warning-severity=') {
830
+                    $this->warningSeverity = (int) substr($arg, 17);
831
+                    $this->overriddenDefaults['warningSeverity'] = true;
832
+                } else if (substr($arg, 0, 7) === 'ignore=') {
833
+                    // Split the ignore string on commas, unless the comma is escaped
834
+                    // using 1 or 3 slashes (\, or \\\,).
835
+                    $patterns = preg_split(
836
+                        '/(?<=(?<!\\\\)\\\\\\\\),|(?<!\\\\),/',
837
+                        substr($arg, 7)
838
+                    );
839
+
840
+                    $ignored = array();
841
+                    foreach ($patterns as $pattern) {
842
+                        $pattern = trim($pattern);
843
+                        if ($pattern === '') {
844
+                            continue;
845
+                        }
812 846
 
813
-                $this->extensions = $newExtensions;
814
-                $this->overriddenDefaults['extensions'] = true;
815
-            } else if (substr($arg, 0, 7) === 'suffix=') {
816
-                $this->suffix = explode(',', substr($arg, 7));
817
-                $this->overriddenDefaults['suffix'] = true;
818
-            } else if (substr($arg, 0, 9) === 'parallel=') {
819
-                $this->parallel = max((int) substr($arg, 9), 1);
820
-                $this->overriddenDefaults['parallel'] = true;
821
-            } else if (substr($arg, 0, 9) === 'severity=') {
822
-                $this->errorSeverity   = (int) substr($arg, 9);
823
-                $this->warningSeverity = $this->errorSeverity;
824
-                $this->overriddenDefaults['errorSeverity']   = true;
825
-                $this->overriddenDefaults['warningSeverity'] = true;
826
-            } else if (substr($arg, 0, 15) === 'error-severity=') {
827
-                $this->errorSeverity = (int) substr($arg, 15);
828
-                $this->overriddenDefaults['errorSeverity'] = true;
829
-            } else if (substr($arg, 0, 17) === 'warning-severity=') {
830
-                $this->warningSeverity = (int) substr($arg, 17);
831
-                $this->overriddenDefaults['warningSeverity'] = true;
832
-            } else if (substr($arg, 0, 7) === 'ignore=') {
833
-                // Split the ignore string on commas, unless the comma is escaped
834
-                // using 1 or 3 slashes (\, or \\\,).
835
-                $patterns = preg_split(
836
-                    '/(?<=(?<!\\\\)\\\\\\\\),|(?<!\\\\),/',
837
-                    substr($arg, 7)
838
-                );
839
-
840
-                $ignored = array();
841
-                foreach ($patterns as $pattern) {
842
-                    $pattern = trim($pattern);
843
-                    if ($pattern === '') {
844
-                        continue;
847
+                        $ignored[$pattern] = 'absolute';
845 848
                     }
846 849
 
847
-                    $ignored[$pattern] = 'absolute';
848
-                }
849
-
850
-                $this->ignored = $ignored;
851
-                $this->overriddenDefaults['ignored'] = true;
852
-            } else if (substr($arg, 0, 10) === 'generator='
853
-                && PHP_CodeSniffer_CBF === false
854
-            ) {
855
-                $this->generator = substr($arg, 10);
856
-                $this->overriddenDefaults['generator'] = true;
857
-            } else if (substr($arg, 0, 9) === 'encoding=') {
858
-                $this->encoding = strtolower(substr($arg, 9));
859
-                $this->overriddenDefaults['encoding'] = true;
860
-            } else if (substr($arg, 0, 10) === 'tab-width=') {
861
-                $this->tabWidth = (int) substr($arg, 10);
862
-                $this->overriddenDefaults['tabWidth'] = true;
863
-            } else {
864
-                if ($this->dieOnUnknownArg === false) {
865
-                    $eqPos = strpos($arg, '=');
866
-                    if ($eqPos === false) {
867
-                        $this->values[$arg] = $arg;
850
+                    $this->ignored = $ignored;
851
+                    $this->overriddenDefaults['ignored'] = true;
852
+                } else if (substr($arg, 0, 10) === 'generator='
853
+                    && PHP_CodeSniffer_CBF === false
854
+                ) {
855
+                    $this->generator = substr($arg, 10);
856
+                    $this->overriddenDefaults['generator'] = true;
857
+                } else if (substr($arg, 0, 9) === 'encoding=') {
858
+                    $this->encoding = strtolower(substr($arg, 9));
859
+                    $this->overriddenDefaults['encoding'] = true;
860
+                } else if (substr($arg, 0, 10) === 'tab-width=') {
861
+                    $this->tabWidth = (int) substr($arg, 10);
862
+                    $this->overriddenDefaults['tabWidth'] = true;
863
+                } else {
864
+                    if ($this->dieOnUnknownArg === false) {
865
+                        $eqPos = strpos($arg, '=');
866
+                        if ($eqPos === false) {
867
+                            $this->values[$arg] = $arg;
868
+                        } else {
869
+                            $value = substr($arg, ($eqPos + 1));
870
+                            $arg   = substr($arg, 0, $eqPos);
871
+                            $this->values[$arg] = $value;
872
+                        }
868 873
                     } else {
869
-                        $value = substr($arg, ($eqPos + 1));
870
-                        $arg   = substr($arg, 0, $eqPos);
871
-                        $this->values[$arg] = $value;
874
+                        $this->processUnknownArgument('--'.$arg, $pos);
872 875
                     }
873
-                } else {
874
-                    $this->processUnknownArgument('--'.$arg, $pos);
875
-                }
876
-            }//end if
876
+                }//end if
877 877
 
878
-            break;
878
+                break;
879 879
         }//end switch
880 880
 
881 881
     }//end processLongArgument()
Please login to merge, or discard this patch.