소스 검색

Show overridden php version in diagnose command, fixes #7497

Jordi Boggiano 7 년 전
부모
커밋
de6432f5f0
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      src/Composer/Command/DiagnoseCommand.php

+ 10 - 1
src/Composer/Command/DiagnoseCommand.php

@@ -16,6 +16,7 @@ use Composer\Composer;
 use Composer\Factory;
 use Composer\Factory;
 use Composer\Config;
 use Composer\Config;
 use Composer\Downloader\TransportException;
 use Composer\Downloader\TransportException;
+use Composer\Repository\PlatformRepository;
 use Composer\Plugin\CommandEvent;
 use Composer\Plugin\CommandEvent;
 use Composer\Plugin\PluginEvents;
 use Composer\Plugin\PluginEvents;
 use Composer\Util\ConfigValidator;
 use Composer\Util\ConfigValidator;
@@ -153,7 +154,15 @@ EOT
 
 
         $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
         $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
 
 
-        $io->write(sprintf('PHP version: <comment>%s</comment>', PHP_VERSION));
+        $platformOverrides = $config->get('platform') ?: array();
+        $platformRepo = new PlatformRepository(array(), $platformOverrides);
+        $phpPkg = $platformRepo->findPackage('php', '*');
+        $phpVersion = $phpPkg->getPrettyVersion();
+        if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
+            $phpVersion .= ' - ' . $phpPkg->getDescription();
+        }
+
+        $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
 
 
         if (defined('PHP_BINARY')) {
         if (defined('PHP_BINARY')) {
             $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
             $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));