Last active
December 18, 2015 18:29
-
-
Save mpdude/5825777 to your computer and use it in GitHub Desktop.
Quick proof-of-concept patch for composer/composer#2022
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Composer/DependencyResolver/RuleSetGenerator.php b/src/Composer/DependencyResolver/RuleSetGenerator.php | |
index b40ce1a..2255c36 100644 | |
--- a/src/Composer/DependencyResolver/RuleSetGenerator.php | |
+++ b/src/Composer/DependencyResolver/RuleSetGenerator.php | |
@@ -12,6 +12,7 @@ | |
namespace Composer\DependencyResolver; | |
+use Composer\Package\LinkConstraint\MultiConstraint; | |
use Composer\Package\PackageInterface; | |
use Composer\Package\AliasPackage; | |
@@ -165,11 +166,25 @@ class RuleSetGenerator | |
} | |
foreach ($package->getConflicts() as $link) { | |
- $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint()); | |
+ $constraints = array(); | |
+ $c = $link->getConstraint(); | |
+ | |
+ if ($c instanceof MultiConstraint) { | |
+ foreach ($c->getConstraints() as $constraint) { | |
+ $constraints[] = $constraint; | |
+ } | |
+ } else { | |
+ $constraints[] = $c; | |
+ } | |
+ | |
+ foreach ($constraints as $constraint) { | |
+ $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $constraint); | |
+ foreach ($possibleConflicts as $conflict) { | |
+ $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link)); | |
+ } | |
- foreach ($possibleConflicts as $conflict) { | |
- $this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link)); | |
} | |
+ | |
} | |
// check obsoletes and implicit obsoletes of a package | |
diff --git a/src/Composer/Package/LinkConstraint/MultiConstraint.php b/src/Composer/Package/LinkConstraint/MultiConstraint.php | |
index 836d565..f6c98b6 100644 | |
--- a/src/Composer/Package/LinkConstraint/MultiConstraint.php | |
+++ b/src/Composer/Package/LinkConstraint/MultiConstraint.php | |
@@ -66,4 +66,9 @@ class MultiConstraint implements LinkConstraintInterface | |
return '['.implode(', ', $constraints).']'; | |
} | |
+ | |
+ public function getConstraints() | |
+ { | |
+ return $this->constraints; | |
+ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment