1
0
Fork 0

Improved variable naming

pull/8850/head
Yanick Witschi 2020-05-06 18:41:11 +02:00 committed by Jordi Boggiano
parent c7f10bdd90
commit 225a6a0a82
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 12 additions and 12 deletions

View File

@ -68,7 +68,7 @@ class PoolBuilder
/** /**
* @psalm-var array<string, ConstraintInterface> * @psalm-var array<string, ConstraintInterface>
*/ */
private $loadedNames = array(); private $loadedPackages = array();
/** /**
* @psalm-var Package[] * @psalm-var Package[]
*/ */
@ -124,11 +124,11 @@ class PoolBuilder
} }
foreach ($request->getFixedPackages() as $package) { foreach ($request->getFixedPackages() as $package) {
$this->loadedNames[$package->getName()] = new EmptyConstraint(); $this->loadedPackages[$package->getName()] = new EmptyConstraint();
// replace means conflict, so if a fixed package replaces a name, no need to load that one, packages would conflict anyways // replace means conflict, so if a fixed package replaces a name, no need to load that one, packages would conflict anyways
foreach ($package->getReplaces() as $link) { foreach ($package->getReplaces() as $link) {
$this->loadedNames[$link->getTarget()] = new EmptyConstraint(); $this->loadedPackages[$link->getTarget()] = new EmptyConstraint();
} }
// TODO in how far can we do the above for conflicts? It's more tricky cause conflicts can be limited to // TODO in how far can we do the above for conflicts? It's more tricky cause conflicts can be limited to
@ -151,7 +151,7 @@ class PoolBuilder
// clean up packagesToLoad for anything we manually marked loaded above // clean up packagesToLoad for anything we manually marked loaded above
foreach ($this->packagesToLoad as $name => $constraint) { foreach ($this->packagesToLoad as $name => $constraint) {
if (isset($this->loadedNames[$name])) { if (isset($this->loadedPackages[$name])) {
unset($this->packagesToLoad[$name]); unset($this->packagesToLoad[$name]);
} }
} }
@ -215,7 +215,7 @@ class PoolBuilder
$this->aliasMap = array(); $this->aliasMap = array();
$this->packagesToLoad = array(); $this->packagesToLoad = array();
$this->loadedNames = array(); $this->loadedPackages = array();
$this->packages = array(); $this->packages = array();
$this->unacceptableFixedPackages = array(); $this->unacceptableFixedPackages = array();
@ -224,14 +224,14 @@ class PoolBuilder
private function markPackageNameForLoading($name, ConstraintInterface $constraint) private function markPackageNameForLoading($name, ConstraintInterface $constraint)
{ {
if (!isset($this->loadedNames[$name])) { if (!isset($this->loadedPackages[$name])) {
$this->packagesToLoad[$name] = $constraint; $this->packagesToLoad[$name] = $constraint;
return; return;
} }
// No need to load this package with this constraint because it is // No need to load this package with this constraint because it is
// a subset of the constraint with which we have already loaded packages // a subset of the constraint with which we have already loaded packages
if ($constraint->isSubsetOf($this->loadedNames[$name])) { if ($constraint->isSubsetOf($this->loadedPackages[$name])) {
return; return;
} }
@ -245,14 +245,14 @@ class PoolBuilder
// We have already loaded that package but not in the constraint that's // We have already loaded that package but not in the constraint that's
// required. We extend the constraint and mark that package as not being loaded // required. We extend the constraint and mark that package as not being loaded
// yet so we get the required package versions // yet so we get the required package versions
$this->packagesToLoad[$name] = MultiConstraint::create(array($this->loadedNames[$name], $constraint), false); $this->packagesToLoad[$name] = MultiConstraint::create(array($this->loadedPackages[$name], $constraint), false);
unset($this->loadedNames[$name]); unset($this->loadedPackages[$name]);
} }
private function loadPackagesMarkedForLoading(Request $request, $repositories) private function loadPackagesMarkedForLoading(Request $request, $repositories)
{ {
foreach ($this->packagesToLoad as $name => $constraint) { foreach ($this->packagesToLoad as $name => $constraint) {
$this->loadedNames[$name] = $constraint; $this->loadedPackages[$name] = $constraint;
} }
$packageBatch = $this->packagesToLoad; $packageBatch = $this->packagesToLoad;
@ -342,7 +342,7 @@ class PoolBuilder
if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) { if ($propagateUpdate && $request->getUpdateAllowTransitiveDependencies()) {
foreach ($package->getReplaces() as $link) { foreach ($package->getReplaces() as $link) {
$replace = $link->getTarget(); $replace = $link->getTarget();
if (isset($this->loadedNames[$replace]) && isset($this->skippedLoad[$replace])) { if (isset($this->loadedPackages[$replace]) && isset($this->skippedLoad[$replace])) {
if ($request->getUpdateAllowTransitiveRootDependencies() || !$this->isRootRequire($request, $this->skippedLoad[$replace])) { if ($request->getUpdateAllowTransitiveRootDependencies() || !$this->isRootRequire($request, $this->skippedLoad[$replace])) {
$this->unfixPackage($request, $replace); $this->unfixPackage($request, $replace);
$this->markPackageNameForLoading($replace, $link->getConstraint()); $this->markPackageNameForLoading($replace, $link->getConstraint());
@ -439,7 +439,7 @@ class PoolBuilder
} }
unset($this->skippedLoad[$name]); unset($this->skippedLoad[$name]);
unset($this->loadedNames[$name]); unset($this->loadedPackages[$name]);
} }
private function getRootAliasesPerPackage(array $aliases) private function getRootAliasesPerPackage(array $aliases)