1
0
Fork 0

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

Fixes #11479
pull/11526/head
Jordi Boggiano 2023-06-23 13:13:20 +02:00 committed by GitHub
parent 1db0a47080
commit 2b18799c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 7 deletions

View File

@ -26,7 +26,7 @@
"composer/ca-bundle": "^1.0", "composer/ca-bundle": "^1.0",
"composer/class-map-generator": "^1.0", "composer/class-map-generator": "^1.0",
"composer/metadata-minifier": "^1.0", "composer/metadata-minifier": "^1.0",
"composer/semver": "^3.0", "composer/semver": "^3.2.5",
"composer/spdx-licenses": "^1.5.7", "composer/spdx-licenses": "^1.5.7",
"composer/xdebug-handler": "^2.0.2 || ^3.0.3", "composer/xdebug-handler": "^2.0.2 || ^3.0.3",
"justinrainbow/json-schema": "^5.2.11", "justinrainbow/json-schema": "^5.2.11",

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "cc535e8c9fc8f1414a1cede463898453", "content-hash": "c50c89580fa044b7523cb55c2d557c87",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",

View File

@ -557,6 +557,19 @@ class Problem
*/ */
protected static function constraintToText(?ConstraintInterface $constraint = null): string 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() : ''; return $constraint ? ' '.$constraint->getPrettyString() : '';
} }
} }

View File

@ -24,7 +24,6 @@ Updating dependencies
Your requirements could not be resolved to an installable set of packages. Your requirements could not be resolved to an installable set of packages.
Problem 1 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-- --EXPECT--

View File

@ -59,7 +59,7 @@ Your requirements could not be resolved to an installable set of packages.
Problem 3 Problem 3
- Root composer.json requires linked library lib-icu 1001.* but it has the wrong version installed, try upgrading the intl extension. - Root composer.json requires linked library lib-icu 1001.* but it has the wrong version installed, try upgrading the intl extension.
Problem 4 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 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". - 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 Problem 6

View File

@ -113,7 +113,7 @@ Your requirements could not be resolved to an installable set of packages.
Problem 3 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. - 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 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 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. - 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 Problem 6
@ -121,7 +121,7 @@ Your requirements could not be resolved to an installable set of packages.
Problem 7 Problem 7
- Root composer.json requires PHP extension ext-xml 1002.* but it has the wrong version installed (%s). - Root composer.json requires PHP extension ext-xml 1002.* but it has the wrong version installed (%s).
Problem 8 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 Problem 9
- Root composer.json requires package/found 2.* -> satisfiable by package/found[2.0.0]. - 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. - package/found 2.0.0 requires unstable/package2 2.* -> found unstable/package2[2.0.0-alpha] but it does not match your minimum-stability.