From 3764b3007ded14db47e3341030b6ac6397aa86af Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 13 Nov 2020 15:58:46 +0100 Subject: [PATCH] Explicit conflict rule generation needs to use pool->whatProvides If relying on packages added by name in the generator aliases will be skipped. --- src/Composer/DependencyResolver/RuleSetGenerator.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Composer/DependencyResolver/RuleSetGenerator.php b/src/Composer/DependencyResolver/RuleSetGenerator.php index 3744bdd2a..19fcc8c12 100644 --- a/src/Composer/DependencyResolver/RuleSetGenerator.php +++ b/src/Composer/DependencyResolver/RuleSetGenerator.php @@ -199,6 +199,7 @@ class RuleSetGenerator /** @var PackageInterface $package */ foreach ($this->addedMap as $package) { foreach ($package->getConflicts() as $link) { + // even if conlict ends up being with an alias, there would be a conflict with at least one actual package by this name if (!isset($this->addedPackagesByNames[$link->getTarget()])) { continue; } @@ -207,11 +208,10 @@ class RuleSetGenerator continue; } - /** @var PackageInterface $possibleConflict */ - foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) { - if ($this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint())) { - $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link)); - } + $conflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint()); + + foreach ($conflicts as $conflict) { + $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link)); } } }