1
0
Fork 0

Explicit conflict rule generation needs to use pool->whatProvides

If relying on packages added by name in the generator aliases will be
skipped.
pull/9477/head
Nils Adermann 2020-11-13 15:58:46 +01:00
parent 045b5c6b6b
commit 3764b3007d
1 changed files with 5 additions and 5 deletions

View File

@ -199,6 +199,7 @@ class RuleSetGenerator
/** @var PackageInterface $package */ /** @var PackageInterface $package */
foreach ($this->addedMap as $package) { foreach ($this->addedMap as $package) {
foreach ($package->getConflicts() as $link) { 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()])) { if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
continue; continue;
} }
@ -207,11 +208,10 @@ class RuleSetGenerator
continue; continue;
} }
/** @var PackageInterface $possibleConflict */ $conflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
if ($this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint())) { foreach ($conflicts as $conflict) {
$this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link)); $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
}
} }
} }
} }