diff --git a/src/Diagnose/PHPStanDiagnoseExtension.php b/src/Diagnose/PHPStanDiagnoseExtension.php index a7eb786ed8..60ab2e5493 100644 --- a/src/Diagnose/PHPStanDiagnoseExtension.php +++ b/src/Diagnose/PHPStanDiagnoseExtension.php @@ -3,8 +3,11 @@ namespace PHPStan\Diagnose; use PHPStan\Command\Output; +use PHPStan\ExtensionInstaller\GeneratedConfig; use PHPStan\Internal\ComposerHelper; use PHPStan\Php\PhpVersion; +use function class_exists; +use function count; use function sprintf; use const PHP_VERSION_ID; @@ -32,6 +35,18 @@ public function print(Output $output): void ComposerHelper::getPhpStanVersion(), )); $output->writeLineFormatted(''); + if (class_exists('PHPStan\ExtensionInstaller\GeneratedConfig')) { + $output->writeLineFormatted('Extension installer:'); + if (count(GeneratedConfig::EXTENSIONS) === 0) { + $output->writeLineFormatted('No extensions installed'); + } + foreach (GeneratedConfig::EXTENSIONS as $name => $extensionConfig) { + $output->writeLineFormatted(sprintf('%s: %s', $name, $extensionConfig['version'] ?? 'Unknown version')); + } + } else { + $output->writeLineFormatted('Extension installer: Not installed'); + } + $output->writeLineFormatted(''); } }