1
0
Fork 0

Fix incorrect --no-dev handling of replaced packages

pull/8621/head
remorhaz 2020-02-18 17:10:41 +02:00
parent 5aff184fbc
commit 339ee953e5
1 changed files with 8 additions and 1 deletions

View File

@ -939,16 +939,23 @@ INITIALIZER;
{ {
$packages = array(); $packages = array();
$include = array(); $include = array();
$replacedBy = array();
foreach ($packageMap as $item) { foreach ($packageMap as $item) {
$package = $item[0]; $package = $item[0];
$name = $package->getName(); $name = $package->getName();
$packages[$name] = $package; $packages[$name] = $package;
foreach ($package->getReplaces() as $replace) {
$replacedBy[$replace->getTarget()] = $name;
}
} }
$add = function (PackageInterface $package) use (&$add, $packages, &$include) { $add = function (PackageInterface $package) use (&$add, $packages, &$include, $replacedBy) {
foreach ($package->getRequires() as $link) { foreach ($package->getRequires() as $link) {
$target = $link->getTarget(); $target = $link->getTarget();
if (isset($replacedBy[$target])) {
$target = $replacedBy[$target];
}
if (!isset($include[$target])) { if (!isset($include[$target])) {
$include[$target] = true; $include[$target] = true;
if (isset($packages[$target])) { if (isset($packages[$target])) {