Skip to content

Commit 38aef23

Browse files
phpstan-botclaude
authored andcommitted
Merge ProcessedFilesDiagnoseExtension into PHPStanDiagnoseExtension
Address review feedback: instead of having a separate DiagnoseExtension for processed files, merge the logic into the existing PHPStanDiagnoseExtension. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 56bb75a commit 38aef23

File tree

4 files changed

+18
-103
lines changed

4 files changed

+18
-103
lines changed

conf/services.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ services:
105105
composerAutoloaderProjectPaths: %composerAutoloaderProjectPaths%
106106
allConfigFiles: %allConfigFiles%
107107
configPhpVersion: %phpVersion%
108+
simpleRelativePathHelper: @simpleRelativePathHelper
108109
autowired: false
109110

110111
# not registered using attributes because there is 2+ instances

src/Analyser/ProcessedFilesDiagnoseExtension.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/Diagnose/PHPStanDiagnoseExtension.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
namespace PHPStan\Diagnose;
44

55
use Phar;
6+
use PHPStan\Analyser\ProcessedFilesCollector;
67
use PHPStan\Command\Output;
78
use PHPStan\ExtensionInstaller\GeneratedConfig;
89
use PHPStan\File\FileHelper;
10+
use PHPStan\File\RelativePathHelper;
911
use PHPStan\Internal\ComposerHelper;
1012
use PHPStan\Php\ComposerPhpVersionFactory;
1113
use PHPStan\Php\PhpVersion;
@@ -42,6 +44,8 @@ public function __construct(
4244
private array $composerAutoloaderProjectPaths,
4345
private array $allConfigFiles,
4446
private ComposerPhpVersionFactory $composerPhpVersionFactory,
47+
private ProcessedFilesCollector $processedFilesCollector,
48+
private RelativePathHelper $simpleRelativePathHelper,
4549
)
4650
{
4751
}
@@ -203,6 +207,19 @@ public function print(Output $output): void
203207
$output->writeLineFormatted($composerAutoloaderProjectPath);
204208
}
205209
$output->writeLineFormatted('');
210+
211+
$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('');
222+
}
206223
}
207224

208225
}

tests/PHPStan/Analyser/ProcessedFilesDiagnoseExtensionTest.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)