Skip to content

Commit ceb885b

Browse files
committed
Runner: allow the Performance report when running phpcbf
As things were, a `phpcbf` run overruled the `Config::$reports` setting / `--report=...` CLI arguments to always only show the `Cbf` report. As running the Performance report can also be useful for `phpcbf` (to find particularly slow fixers), I'm proposing to change the logic which overrules the reports setting for `phpcbf` to allow for displaying the `Performance` report as well (if requested).
1 parent 529cd87 commit ceb885b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Runner.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,15 @@ public function runPHPCBF()
194194
$this->config->showSources = false;
195195
$this->config->recordErrors = false;
196196
$this->config->reportFile = null;
197-
$this->config->reports = ['cbf' => null];
197+
198+
// Only use the "Cbf" report, but allow for the Performance report as well.
199+
$originalReports = array_change_key_case($this->config->reports, CASE_LOWER);
200+
$newReports = ['cbf' => null];
201+
if (array_key_exists('performance', $originalReports) === true) {
202+
$newReports['performance'] = $originalReports['performance'];
203+
}
204+
205+
$this->config->reports = $newReports;
198206

199207
// If a standard tries to set command line arguments itself, some
200208
// may be blocked because PHPCBF is running, so stop the script

0 commit comments

Comments
 (0)