From 339ee953e5c9a4e763a43b6c457d8ad4eb9877d3 Mon Sep 17 00:00:00 2001 From: remorhaz Date: Tue, 18 Feb 2020 17:10:41 +0200 Subject: [PATCH] Fix incorrect --no-dev handling of replaced packages --- src/Composer/Autoload/AutoloadGenerator.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 2bb0c98b1..ca1fc10d4 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -939,16 +939,23 @@ INITIALIZER; { $packages = array(); $include = array(); + $replacedBy = array(); foreach ($packageMap as $item) { $package = $item[0]; $name = $package->getName(); $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) { $target = $link->getTarget(); + if (isset($replacedBy[$target])) { + $target = $replacedBy[$target]; + } if (!isset($include[$target])) { $include[$target] = true; if (isset($packages[$target])) {