Skip to content

Commit d55602b

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 bf71252 commit d55602b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Runner.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,15 @@ public function runPHPCBF()
184184
$this->config->showSources = false;
185185
$this->config->recordErrors = false;
186186
$this->config->reportFile = null;
187-
$this->config->reports = ['cbf' => null];
187+
188+
// Only use the "Cbf" report, but allow for the Performance report as well.
189+
$originalReports = array_change_key_case($this->config->reports, CASE_LOWER);
190+
$newReports = ['cbf' => null];
191+
if (array_key_exists('performance', $originalReports) === true) {
192+
$newReports['performance'] = $originalReports['performance'];
193+
}
194+
195+
$this->config->reports = $newReports;
188196

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

0 commit comments

Comments
 (0)