未验证 提交 2b18799c 编写于 作者: J Jordi Boggiano 提交者: GitHub

Fix problem output of exact constraints to state more clearly that only those...

Fix problem output of exact constraints to state more clearly that only those versions are matched (#11521)

Fixes #11479
上级 1db0a470
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "cc535e8c9fc8f1414a1cede463898453",
"content-hash": "c50c89580fa044b7523cb55c2d557c87",
"packages": [
{
"name": "composer/ca-bundle",
......
......@@ -557,6 +557,19 @@ private static function computeCheckForLowerPrioRepo(Pool $pool, bool $isVerbose
*/
protected static function constraintToText(?ConstraintInterface $constraint = null): string
{
if ($constraint instanceof Constraint && $constraint->getOperator() === Constraint::STR_OP_EQ && !str_starts_with($constraint->getVersion(), 'dev-')) {
if (!Preg::isMatch('{^\d+(?:\.\d+)*$}', $constraint->getPrettyString())) {
return ' '.$constraint->getPrettyString() .' (exact version match)';
}
$versions = [$constraint->getPrettyString()];
for ($i = 3 - substr_count($versions[0], '.'); $i > 0; $i--) {
$versions[] = end($versions) . '.0';
}
return ' ' . $constraint->getPrettyString() . ' (exact version match: ' . (count($versions) > 1 ? implode(', ', array_slice($versions, 0, -1)) . ' or ' . end($versions) : $versions[0]) . ')';
}
return $constraint ? ' '.$constraint->getPrettyString() : '';
}
}
......@@ -24,7 +24,6 @@ Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires a/aliased 3.0.2 as 3.0.3, found a/aliased[1.2.3] but it does not match the constraint.
- Root composer.json requires a/aliased 3.0.2 as 3.0.3 (exact version match), found a/aliased[1.2.3] but it does not match the constraint.
--EXPECT--
......@@ -59,7 +59,7 @@ Your requirements could not be resolved to an installable set of packages.
Problem 3
- Root composer.json requires linked library lib-icu 1001.* but it has the wrong version installed, try upgrading the intl extension.
Problem 4
- Root composer.json requires PHP extension ext-foobar 1.0.0 but it is missing from your system. Install or enable PHP's foobar extension.
- Root composer.json requires PHP extension ext-foobar 1.0.0 (exact version match: 1.0.0 or 1.0.0.0) but it is missing from your system. Install or enable PHP's foobar extension.
Problem 5
- Root composer.json requires PHP extension ext-pcre ^8 but the ext-pcre package is disabled by your platform config. Enable it again with "composer config platform.ext-pcre --unset".
Problem 6
......
......@@ -113,7 +113,7 @@ Your requirements could not be resolved to an installable set of packages.
Problem 3
- Root composer.json requires non-existent/pkg, it could not be found in any version, there may be a typo in the package name.
Problem 4
- Root composer.json requires stable-requiree-excluded/pkg 1.0.1, found stable-requiree-excluded/pkg[1.0.1] but the package is fixed to 1.0.0 (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.
- Root composer.json requires stable-requiree-excluded/pkg 1.0.1 (exact version match: 1.0.1 or 1.0.1.0), found stable-requiree-excluded/pkg[1.0.1] but the package is fixed to 1.0.0 (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.
Problem 5
- Root composer.json requires linked library lib-xml 1002.* but it has the wrong version installed or is missing from your system, make sure to load the extension providing it.
Problem 6
......@@ -121,7 +121,7 @@ Your requirements could not be resolved to an installable set of packages.
Problem 7
- Root composer.json requires PHP extension ext-xml 1002.* but it has the wrong version installed (%s).
Problem 8
- Root composer.json requires php 1 but your php version (%s) does not satisfy that requirement.
- Root composer.json requires php 1 (exact version match: 1, 1.0, 1.0.0 or 1.0.0.0) but your php version (%s) does not satisfy that requirement.
Problem 9
- Root composer.json requires package/found 2.* -> satisfiable by package/found[2.0.0].
- package/found 2.0.0 requires unstable/package2 2.* -> found unstable/package2[2.0.0-alpha] but it does not match your minimum-stability.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册