1
0
Fork 0

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

pull/118/head
Nils Adermann 2011-11-19 15:00:56 +01:00
parent 4140f08d9c
commit 46e1001b4b
1 changed files with 14 additions and 3 deletions

View File

@ -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;
}
}