Skip to content

Commit

Permalink
Diagnose extension: Info about extensions installed via extension-ins…
Browse files Browse the repository at this point in the history
…taller
  • Loading branch information
ondrejmirtes committed Jul 14, 2024
1 parent a0dc9ed commit db71f04
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Diagnose/PHPStanDiagnoseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -32,6 +35,18 @@ public function print(Output $output): void
ComposerHelper::getPhpStanVersion(),
));
$output->writeLineFormatted('');
if (class_exists('PHPStan\ExtensionInstaller\GeneratedConfig')) {
$output->writeLineFormatted('<info>Extension installer:</info>');
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('<info>Extension installer:</info> Not installed');
}
$output->writeLineFormatted('');
}

}

0 comments on commit db71f04

Please sign in to comment.