Skip to content

Commit b469e78

Browse files
committed
You can only specify one --report CLI arg now, which means ruleset can't override the CLI
1 parent ee4ed0a commit b469e78

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
3131
-- Thanks to Sergey Morozov for the patch
3232
- All sniff errors are now exceptions and caught to stop infinite loops
3333
- installed_paths config setting can now point directly to a standard instead of the dir above
34+
- --report=full,summary,info instead of --report=full --report=summary --report=info
3435
- Improved the performance of the CSS tokenizer, especially on very large CSS files (thousands of lines)
3536
-- Thanks to Klaus Purer for the patch
3637
- Defined tokens for lower PHP versions are now phpcs-specific strings instead of ints

src/Config.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,8 @@ public function processLongArgument($arg, $pos)
712712
|| substr($arg, 0, 7) === 'report-')
713713
&& PHP_CODESNIFFER_CBF === false
714714
) {
715+
$reports = array();
716+
715717
if ($arg[6] === '-') {
716718
// This is a report with file output.
717719
$split = strpos($arg, '=');
@@ -737,18 +739,27 @@ public function processLongArgument($arg, $pos)
737739
}
738740
}//end if
739741
}//end if
742+
743+
$reports[$report] = $output;
740744
} else {
741745
// This is a single report.
742-
$report = substr($arg, 7);
743-
$output = null;
746+
if (isset($this->overriddenDefaults['reports']) === true) {
747+
break;
748+
}
749+
750+
$reportNames = explode(',', substr($arg, 7));
751+
foreach ($reportNames as $report) {
752+
$reports[$report] = null;
753+
}
744754
}//end if
745755

746756
// Remove the default value so the CLI value overrides it.
747757
if (isset($this->overriddenDefaults['reports']) === false) {
748-
$this->reports = array();
758+
$this->reports = $reports;
759+
} else {
760+
$this->reports = array_merge($this->reports, $reports);
749761
}
750762

751-
$this->reports[$report] = $output;
752763
$this->overriddenDefaults['reports'] = true;
753764
} else if (substr($arg, 0, 9) === 'standard=') {
754765
$standards = trim(substr($arg, 9));

0 commit comments

Comments
 (0)