Consider replaces when checking package dependents
parent
82d0b12b1c
commit
20eb9e66cf
|
@ -67,6 +67,24 @@ abstract class BaseRepository implements RepositoryInterface
|
|||
// Replacements are considered valid reasons for a package to be installed during forward resolution
|
||||
if (!$invert) {
|
||||
$links += $package->getReplaces();
|
||||
|
||||
foreach ($package->getReplaces() as $link) {
|
||||
foreach ($needles as $needle) {
|
||||
if ($link->getSource() === $needle) {
|
||||
if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
|
||||
// already displayed this node's dependencies, cutting short
|
||||
if (in_array($link->getTarget(), $packagesInTree)) {
|
||||
$results[$link->getTarget()] = array($package, $link, false);
|
||||
continue;
|
||||
}
|
||||
$packagesInTree[] = $link->getTarget();
|
||||
$dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : array();
|
||||
$results[] = array($package, $link, $dependents);
|
||||
$needles[] = $link->getTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Require-dev is only relevant for the root package
|
||||
|
@ -81,12 +99,12 @@ abstract class BaseRepository implements RepositoryInterface
|
|||
if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
|
||||
// already displayed this node's dependencies, cutting short
|
||||
if (in_array($link->getSource(), $packagesInTree)) {
|
||||
$results[$link->getSource()] = array($package, $link, false);
|
||||
$results[] = array($package, $link, false);
|
||||
continue;
|
||||
}
|
||||
$packagesInTree[] = $link->getSource();
|
||||
$dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
|
||||
$results[$link->getSource()] = array($package, $link, $dependents);
|
||||
$results[] = array($package, $link, $dependents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue