Explorar o código

Avoid generating duplicate conflict rules

For each version of each package we create a conflict rule with each
other version. These are then added to the rule set and skipped if
duplicate so instead we can just generate them only once to begin with
and avoid unnecessary memory allocation and duplication lookups.
Nils Adermann %!s(int64=10) %!d(string=hai) anos
pai
achega
4a945da55b
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/Composer/DependencyResolver/RuleSetGenerator.php

+ 1 - 1
src/Composer/DependencyResolver/RuleSetGenerator.php

@@ -241,7 +241,7 @@ class RuleSetGenerator
 
                 if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
                     $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
-                } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
+                } elseif (!$this->obsoleteImpossibleForAlias($package, $provider) && $package->id <= $provider->id) {
                     $reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
                     $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createConflictRule($package, $provider, $reason, $package));
                 }