Sfoglia il codice sorgente

Replaced packages have higher priority, even if wrong version is replaced

Nils Adermann 13 anni fa
parent
commit
46e1001b4b
1 ha cambiato i file con 14 aggiunte e 3 eliminazioni
  1. 14 3
      src/Composer/DependencyResolver/DefaultPolicy.php

+ 14 - 3
src/Composer/DependencyResolver/DefaultPolicy.php

@@ -148,12 +148,23 @@ class DefaultPolicy implements PolicyInterface
         return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
     }
 
+    /**
+    * Checks if source replaces a package with the same name as target.
+    *
+    * Replace constraints are ignored. This method should only be used for
+    * prioritisation, not for actual constraint verification.
+    *
+    * @param PackageInterface $source
+    * @param PackageInterface $target
+    * @return bool
+    */
     protected function replaces(PackageInterface $source, PackageInterface $target)
     {
         foreach ($source->getReplaces() as $link) {
-            if ($link->getTarget() === $target->getName() &&
-                (null === $link->getConstraint() ||
-                $link->getConstraint()->matches(new VersionConstraint('==', $target->getVersion())))) {
+            if ($link->getTarget() === $target->getName()
+//                && (null === $link->getConstraint() ||
+//                $link->getConstraint()->matches(new VersionConstraint('==', $target->getVersion())))) {
+                ) {
                 return true;
             }
         }