|
@@ -66,7 +66,7 @@ class Problem
|
|
* @param array $installedMap A map of all present packages
|
|
* @param array $installedMap A map of all present packages
|
|
* @return string
|
|
* @return string
|
|
*/
|
|
*/
|
|
- public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, array $installedMap = array(), array $learnedPool = array())
|
|
|
|
|
|
+ public function getPrettyString(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, array $installedMap = array(), array $learnedPool = array())
|
|
{
|
|
{
|
|
// TODO doesn't this entirely defeat the purpose of the problem sections? what's the point of sections?
|
|
// TODO doesn't this entirely defeat the purpose of the problem sections? what's the point of sections?
|
|
$reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
|
|
$reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
|
|
@@ -90,13 +90,13 @@ class Problem
|
|
}
|
|
}
|
|
|
|
|
|
if (empty($packages)) {
|
|
if (empty($packages)) {
|
|
- return "\n ".implode(self::getMissingPackageReason($repositorySet, $request, $pool, $packageName, $constraint));
|
|
|
|
|
|
+ return "\n ".implode(self::getMissingPackageReason($repositorySet, $request, $pool, $isVerbose, $packageName, $constraint));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
$messages = array();
|
|
$messages = array();
|
|
foreach ($reasons as $rule) {
|
|
foreach ($reasons as $rule) {
|
|
- $messages[] = $rule->getPrettyString($repositorySet, $request, $pool, $installedMap, $learnedPool);
|
|
|
|
|
|
+ $messages[] = $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose, $installedMap, $learnedPool);
|
|
}
|
|
}
|
|
|
|
|
|
return "\n - ".implode("\n - ", array_unique($messages));
|
|
return "\n - ".implode("\n - ", array_unique($messages));
|
|
@@ -138,7 +138,7 @@ class Problem
|
|
/**
|
|
/**
|
|
* @internal
|
|
* @internal
|
|
*/
|
|
*/
|
|
- public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, $packageName, $constraint = null)
|
|
|
|
|
|
+ public static function getMissingPackageReason(RepositorySet $repositorySet, Request $request, Pool $pool, $isVerbose, $packageName, $constraint = null)
|
|
{
|
|
{
|
|
// handle php/hhvm
|
|
// handle php/hhvm
|
|
if ($packageName === 'php' || $packageName === 'php-64bit' || $packageName === 'hhvm') {
|
|
if ($packageName === 'php' || $packageName === 'php-64bit' || $packageName === 'hhvm') {
|
|
@@ -210,7 +210,7 @@ class Problem
|
|
return $rootReqs[$packageName]->matches(new Constraint('==', $p->getVersion()));
|
|
return $rootReqs[$packageName]->matches(new Constraint('==', $p->getVersion()));
|
|
});
|
|
});
|
|
if (0 === count($filtered)) {
|
|
if (0 === count($filtered)) {
|
|
- return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages).' but '.(self::hasMultipleNames($packages) ? 'these conflict' : 'it conflicts').' with your root composer.json require ('.$rootReqs[$packageName]->getPrettyString().').');
|
|
|
|
|
|
+ return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose).' but '.(self::hasMultipleNames($packages) ? 'these conflict' : 'it conflicts').' with your root composer.json require ('.$rootReqs[$packageName]->getPrettyString().').');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -220,7 +220,7 @@ class Problem
|
|
return $fixedConstraint->matches(new Constraint('==', $p->getVersion()));
|
|
return $fixedConstraint->matches(new Constraint('==', $p->getVersion()));
|
|
});
|
|
});
|
|
if (0 === count($filtered)) {
|
|
if (0 === count($filtered)) {
|
|
- return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages).' but the package is fixed to '.$fixedPackage->getPrettyVersion().' (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.');
|
|
|
|
|
|
+ return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose).' but the package is fixed to '.$fixedPackage->getPrettyVersion().' (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -229,15 +229,15 @@ class Problem
|
|
});
|
|
});
|
|
|
|
|
|
if (!$nonLockedPackages) {
|
|
if (!$nonLockedPackages) {
|
|
- return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages).' in lock file but not in remote repositories, make sure you avoid updating this package to keep the one from lock file.');
|
|
|
|
|
|
+ return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose).' in lock file but not in remote repositories, make sure you avoid updating this package to keep the one from lock file.');
|
|
}
|
|
}
|
|
|
|
|
|
- return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages).' but '.(self::hasMultipleNames($packages) ? 'these conflict' : 'it conflicts').' with another require.');
|
|
|
|
|
|
+ return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose).' but '.(self::hasMultipleNames($packages) ? 'these conflict' : 'it conflicts').' with another require.');
|
|
}
|
|
}
|
|
|
|
|
|
// check if the package is found when bypassing stability checks
|
|
// check if the package is found when bypassing stability checks
|
|
if ($packages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES)) {
|
|
if ($packages = $repositorySet->findPackages($packageName, $constraint, RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES)) {
|
|
- return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match your minimum-stability.');
|
|
|
|
|
|
+ return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match your minimum-stability.');
|
|
}
|
|
}
|
|
|
|
|
|
// check if the package is found when bypassing the constraint check
|
|
// check if the package is found when bypassing the constraint check
|
|
@@ -257,10 +257,10 @@ class Problem
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ', 'satisfiable by '.self::getPackageList($nextRepoPackages).' from '.$nextRepo->getRepoName().' but '.self::getPackageList($higherRepoPackages).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.');
|
|
|
|
|
|
+ return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', it is ', 'satisfiable by '.self::getPackageList($nextRepoPackages, $isVerbose).' from '.$nextRepo->getRepoName().' but '.self::getPackageList($higherRepoPackages, $isVerbose).' from '.reset($higherRepoPackages)->getRepository()->getRepoName().' has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.');
|
|
}
|
|
}
|
|
|
|
|
|
- return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match your constraint.');
|
|
|
|
|
|
+ return array("- Root composer.json requires $packageName".self::constraintToText($constraint) . ', ', 'found '.self::getPackageList($packages, $isVerbose).' but '.(self::hasMultipleNames($packages) ? 'these do' : 'it does').' not match your constraint.');
|
|
}
|
|
}
|
|
|
|
|
|
if (!preg_match('{^[A-Za-z0-9_./-]+$}', $packageName)) {
|
|
if (!preg_match('{^[A-Za-z0-9_./-]+$}', $packageName)) {
|
|
@@ -287,7 +287,7 @@ class Problem
|
|
/**
|
|
/**
|
|
* @internal
|
|
* @internal
|
|
*/
|
|
*/
|
|
- public static function getPackageList(array $packages)
|
|
|
|
|
|
+ public static function getPackageList(array $packages, $isVerbose)
|
|
{
|
|
{
|
|
$prepared = array();
|
|
$prepared = array();
|
|
foreach ($packages as $package) {
|
|
foreach ($packages as $package) {
|
|
@@ -299,6 +299,25 @@ class Problem
|
|
if (isset($package['versions'][VersionParser::DEV_MASTER_ALIAS]) && isset($package['versions']['dev-master'])) {
|
|
if (isset($package['versions'][VersionParser::DEV_MASTER_ALIAS]) && isset($package['versions']['dev-master'])) {
|
|
unset($package['versions'][VersionParser::DEV_MASTER_ALIAS]);
|
|
unset($package['versions'][VersionParser::DEV_MASTER_ALIAS]);
|
|
}
|
|
}
|
|
|
|
+ if (!$isVerbose && count($package['versions']) > 4) {
|
|
|
|
+ $filtered = array();
|
|
|
|
+ $byMajor = array();
|
|
|
|
+ foreach ($package['versions'] as $version => $pretty) {
|
|
|
|
+ $byMajor[preg_replace('{^(\d+)\..*}', '$1', $version)][] = $pretty;
|
|
|
|
+ }
|
|
|
|
+ foreach ($byMajor as $versions) {
|
|
|
|
+ if (count($versions) > 4) {
|
|
|
|
+ $filtered[] = $versions[0];
|
|
|
|
+ $filtered[] = '...';
|
|
|
|
+ $filtered[] = $versions[count($versions) - 1];
|
|
|
|
+ } else {
|
|
|
|
+ $filtered = array_merge($filtered, $versions);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $package['versions'] = $filtered;
|
|
|
|
+ }
|
|
|
|
+
|
|
$prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
|
|
$prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
|
|
}
|
|
}
|
|
|
|
|