From fa5a94143a5158383bae92068f78caa23ee30105 Mon Sep 17 00:00:00 2001 From: Vic Metcalfe Date: Mon, 15 Jan 2018 09:50:22 -0500 Subject: [PATCH] Show reason for php version package mismatch due to config.platform --- src/Composer/DependencyResolver/Problem.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Composer/DependencyResolver/Problem.php b/src/Composer/DependencyResolver/Problem.php index ba9eb9774..7fa40641b 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -11,6 +11,7 @@ */ namespace Composer\DependencyResolver; +use Composer\Package\CompletePackageInterface; /** * Represents a problem detected while solving dependencies @@ -91,7 +92,13 @@ class Problem // handle php/hhvm if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') { $available = $this->pool->whatProvides($job['packageName']); - $version = count($available) ? $available[0]->getPrettyVersion() : phpversion(); + $firstAvailable = reset($available); + + $version = count($available) ? $firstAvailable->getPrettyVersion() : phpversion(); + if (count($available) && $firstAvailable instanceof CompletePackageInterface) { + $version .= '; ' . $firstAvailable->getDescription(); + } + $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';