function PoolBuilder::markPackageNameForLoading
3 calls to PoolBuilder::markPackageNameForLoading()
- PoolBuilder::loadPackage in vendor/
composer/ composer/ src/ Composer/ DependencyResolver/ PoolBuilder.php - PoolBuilder::markPackageNameForLoadingIfRequired in vendor/
composer/ composer/ src/ Composer/ DependencyResolver/ PoolBuilder.php - PoolBuilder::unlockPackage in vendor/
composer/ composer/ src/ Composer/ DependencyResolver/ PoolBuilder.php - Reverts the decision to use a locked package if a partial update with transitive dependencies found that this package actually needs to be updated
File
-
vendor/
composer/ composer/ src/ Composer/ DependencyResolver/ PoolBuilder.php, line 348
Class
- PoolBuilder
- @author Nils Adermann <naderman@naderman.de>
Namespace
Composer\DependencyResolverCode
private function markPackageNameForLoading(Request $request, string $name, ConstraintInterface $constraint) : void {
// Skip platform requires at this stage
if (PlatformRepository::isPlatformPackage($name)) {
return;
}
// Root require (which was not unlocked) already loaded the maximum range so no
// need to check anything here
if (isset($this->maxExtendedReqs[$name])) {
return;
}
// Root requires can not be overruled by dependencies so there is no point in
// extending the loaded constraint for those.
// This is triggered when loading a root require which was locked but got unlocked, then
// we make sure that we load at most the intervals covered by the root constraint.
$rootRequires = $request->getRequires();
if (isset($rootRequires[$name]) && !Intervals::isSubsetOf($constraint, $rootRequires[$name])) {
$constraint = $rootRequires[$name];
}
// Not yet loaded or already marked for a reload, set the constraint to be loaded
if (!isset($this->loadedPackages[$name])) {
// Maybe it was already marked before but not loaded yet. In that case
// we have to extend the constraint (we don't check if they are identical because
// MultiConstraint::create() will optimize anyway)
if (isset($this->packagesToLoad[$name])) {
// Already marked for loading and this does not expand the constraint to be loaded, nothing to do
if (Intervals::isSubsetOf($constraint, $this->packagesToLoad[$name])) {
return;
}
// extend the constraint to be loaded
$constraint = Intervals::compactConstraint(MultiConstraint::create([
$this->packagesToLoad[$name],
$constraint,
], false));
}
$this->packagesToLoad[$name] = $constraint;
return;
}
// No need to load this package with this constraint because it is
// a subset of the constraint with which we have already loaded packages
if (Intervals::isSubsetOf($constraint, $this->loadedPackages[$name])) {
return;
}
// 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
// yet so we get the required package versions
$this->packagesToLoad[$name] = Intervals::compactConstraint(MultiConstraint::create([
$this->loadedPackages[$name],
$constraint,
], false));
unset($this->loadedPackages[$name]);
}