Skip to content

Commit 22c8198

Browse files
committed
fix
1 parent a7e01aa commit 22c8198

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/Command/AnalyseApplication.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private function runAnalyser(
247247

248248
if (!$debug) {
249249
$preFileCallback = null;
250-
$postFileCallback = function (int $step, array $processedFiles = []) use ($errorOutput): void {
250+
$postFileCallback = function (int $step, array $processedFiles) use ($errorOutput): void {
251251
$errorOutput->getStyle()->progressAdvance($step);
252252
$this->processedFilesCollector->addProcessedFiles(array_values($processedFiles));
253253
};
@@ -263,7 +263,7 @@ private function runAnalyser(
263263
$postFileCallback = null;
264264
if ($stdOutput->isDebug()) {
265265
$previousMemory = memory_get_peak_usage(true);
266-
$postFileCallback = function (int $step, array $processedFiles = []) use ($stdOutput, &$previousMemory, &$startTime, &$linesOfCode): void {
266+
$postFileCallback = function (int $step, array $processedFiles) use ($stdOutput, &$previousMemory, &$startTime, &$linesOfCode): void {
267267
if ($startTime === null) {
268268
throw new ShouldNotHappenException();
269269
}

src/Diagnose/PHPStanDiagnoseExtension.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,19 @@ public function print(Output $output): void
209209
$output->writeLineFormatted('');
210210

211211
$topFiles = $this->processedFilesCollector->getTopMostAnalysedFiles(5);
212-
if (count($topFiles) > 0) {
213-
$output->writeLineFormatted('<info>Most often analysed files:</info>');
214-
foreach ($topFiles as $file => $count) {
215-
$output->writeLineFormatted(sprintf(
216-
' %s: %d times',
217-
$this->simpleRelativePathHelper->getRelativePath($file),
218-
$count,
219-
));
220-
}
221-
$output->writeLineFormatted('');
212+
if (count($topFiles) <= 0) {
213+
return;
222214
}
215+
216+
$output->writeLineFormatted('<info>Most often analysed files:</info>');
217+
foreach ($topFiles as $file => $count) {
218+
$output->writeLineFormatted(sprintf(
219+
' %s: %d times',
220+
$this->simpleRelativePathHelper->getRelativePath($file),
221+
$count,
222+
));
223+
}
224+
$output->writeLineFormatted('');
223225
}
224226

225227
}

0 commit comments

Comments
 (0)