function Problem::computeCheckForLowerPrioRepo
Parameters
non-empty-array<PackageInterface> $higherRepoPackages:
non-empty-array<PackageInterface> $allReposPackages:
Return value
array{0: string, 1: string}
1 call to Problem::computeCheckForLowerPrioRepo()
- Problem::getMissingPackageReason in vendor/
composer/ composer/ src/ Composer/ DependencyResolver/ Problem.php - @internal
File
-
vendor/
composer/ composer/ src/ Composer/ DependencyResolver/ Problem.php, line 580
Class
- Problem
- Represents a problem detected while solving dependencies
Namespace
Composer\DependencyResolverCode
private static function computeCheckForLowerPrioRepo(Pool $pool, bool $isVerbose, string $packageName, array $higherRepoPackages, array $allReposPackages, string $reason, ?ConstraintInterface $constraint = null) : array {
$nextRepoPackages = [];
$nextRepo = null;
foreach ($allReposPackages as $package) {
if ($nextRepo === null || $nextRepo === $package->getRepository()) {
$nextRepoPackages[] = $package;
$nextRepo = $package->getRepository();
}
else {
break;
}
}
assert(null !== $nextRepo);
if (\count($higherRepoPackages) > 0) {
$topPackage = reset($higherRepoPackages);
if ($topPackage instanceof RootPackageInterface) {
return [
"- Root composer.json requires {$packageName}" . self::constraintToText($constraint) . ', it is ',
'satisfiable by ' . self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint) . ' from ' . $nextRepo->getRepoName() . ' but ' . $topPackage->getPrettyName() . ' ' . $topPackage->getPrettyVersion() . ' is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance.',
];
}
}
if ($nextRepo instanceof LockArrayRepository) {
$singular = count($higherRepoPackages) === 1;
$suggestion = 'Make sure you either fix the ' . $reason . ' or avoid updating this package to keep the one present in the lock file (' . self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint) . ').';
// symlinked path repos cannot be locked so do not suggest keeping it locked
if ($nextRepoPackages[0]->getDistType() === 'path') {
$transportOptions = $nextRepoPackages[0]->getTransportOptions();
if (!isset($transportOptions['symlink']) || $transportOptions['symlink'] !== false) {
$suggestion = 'Make sure you fix the ' . $reason . ' as packages installed from symlinked path repos are updated even in partial updates and the one from the lock file can thus not be used.';
}
}
return [
"- Root composer.json requires {$packageName}" . self::constraintToText($constraint) . ', ',
'found ' . self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint) . ' but ' . ($singular ? 'it does' : 'these do') . ' not match your ' . $reason . ' and ' . ($singular ? 'is' : 'are') . ' therefore not installable. ' . $suggestion,
];
}
return [
"- Root composer.json requires {$packageName}" . self::constraintToText($constraint) . ', it is ',
'satisfiable by ' . self::getPackageList($nextRepoPackages, $isVerbose, $pool, $constraint) . ' from ' . $nextRepo->getRepoName() . ' but ' . self::getPackageList($higherRepoPackages, $isVerbose, $pool, $constraint) . ' from ' . reset($higherRepoPackages)->getRepository()
->getRepoName() . ' has higher repository priority. The packages from the higher priority repository do not match your ' . $reason . ' and are therefore not installable. That repository is canonical so the lower priority repo\'s packages are not installable. See https://getcomposer.org/repoprio for details and assistance.',
];
}