Quellcode durchsuchen

Clarify output when something is installed in the wrong version, refs #5259

Jordi Boggiano vor 9 Jahren
Ursprung
Commit
4f2ae0a1d9
1 geänderte Dateien mit 12 neuen und 4 gelöschten Zeilen
  1. 12 4
      src/Composer/Repository/BaseRepository.php

+ 12 - 4
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);
-                    }
                 }
             }
         }