1
0
Fork 0

List relevant conflicts in why/why-not, fixes #9693

pull/9542/head
Jordi Boggiano 2021-02-24 16:36:09 +01:00
parent 09639a0cfc
commit 8da3b3b9be
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 12 additions and 0 deletions

View File

@ -165,6 +165,18 @@ class InstalledRepository extends CompositeRepository
} }
} }
// List conflicts against X as they may explain why the current version was selected, or explain why it is rejected if the conflict matched when inverting
foreach ($package->getConflicts() as $link) {
if (in_array($link->getTarget(), $needles)) {
foreach ($this->findPackages($link->getTarget()) as $pkg) {
$version = new Constraint('=', $pkg->getVersion());
if ($link->getConstraint()->matches($version) === $invert) {
$results[] = array($package, $link, false);
}
}
}
}
// When inverting, we need to check for conflicts of the needles' requirements against installed packages // When inverting, we need to check for conflicts of the needles' requirements against installed packages
if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) { if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
foreach ($package->getRequires() as $link) { foreach ($package->getRequires() as $link) {