From 46e1001b4b4a03d8b49322b6fe058e54255d6a59 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 19 Nov 2011 15:00:56 +0100 Subject: [PATCH] Replaced packages have higher priority, even if wrong version is replaced --- .../DependencyResolver/DefaultPolicy.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Composer/DependencyResolver/DefaultPolicy.php b/src/Composer/DependencyResolver/DefaultPolicy.php index fb6c219a7..41918b260 100644 --- a/src/Composer/DependencyResolver/DefaultPolicy.php +++ b/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; } }