From 4f2ae0a1d937a82552a7b682e3af42ba06410e93 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 28 Apr 2016 22:11:48 +0100 Subject: [PATCH] Clarify output when something is installed in the wrong version, refs #5259 --- src/Composer/Repository/BaseRepository.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Composer/Repository/BaseRepository.php b/src/Composer/Repository/BaseRepository.php index b4382b1b1..37321c713 100644 --- a/src/Composer/Repository/BaseRepository.php +++ b/src/Composer/Repository/BaseRepository.php @@ -107,6 +107,18 @@ abstract class BaseRepository implements RepositoryInterface // When inverting, we need to check for conflicts of the needles' requirements against installed packages if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) { foreach ($package->getRequires() as $link) { + if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) { + if ($this->findPackage($link->getTarget(), $link->getConstraint())) { + continue; + } + + $platformPkg = $this->findPackage($link->getTarget(), '*'); + $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing'; + $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false); + + continue; + } + foreach ($this->getPackages() as $pkg) { if (!in_array($link->getTarget(), $pkg->getNames())) { continue; @@ -134,10 +146,6 @@ abstract class BaseRepository implements RepositoryInterface continue 2; } - - if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) { - $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' but it is missing'), false); - } } } }