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