1
0
Fork 0

Temporary save the package-name into a variable

this reduces number of unnecessary function calls in the hot path of "composer update"
pull/7451/head
Markus Staab 2018-07-09 14:09:46 +02:00 committed by GitHub
parent f24fcea35b
commit 07383552b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -232,7 +232,8 @@ class RuleSetGenerator
}
}
$obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
$packageName = $package->getName();
$obsoleteProviders = $this->pool->whatProvides($packageName, null);
foreach ($obsoleteProviders as $provider) {
if ($provider === $package) {
@ -242,7 +243,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)) {
$reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
$reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
$this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRule2Literals($package, $provider, $reason, $package));
}
}