From a7a14ea860ccf5bac9524367c37fdcb15a4ec317 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 14 Nov 2024 11:26:58 +0100 Subject: [PATCH] Show root package version in error output for circular dependencies for added clarity --- src/Composer/DependencyResolver/Problem.php | 2 +- .../Test/Fixtures/installer/circular-dependency-errors.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/DependencyResolver/Problem.php b/src/Composer/DependencyResolver/Problem.php index c58d8601b..fa84ae0c0 100644 --- a/src/Composer/DependencyResolver/Problem.php +++ b/src/Composer/DependencyResolver/Problem.php @@ -598,7 +598,7 @@ class Problem 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().' is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance.', + '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.', ]; } } diff --git a/tests/Composer/Test/Fixtures/installer/circular-dependency-errors.test b/tests/Composer/Test/Fixtures/installer/circular-dependency-errors.test index 1bd4518f7..0a9f42544 100644 --- a/tests/Composer/Test/Fixtures/installer/circular-dependency-errors.test +++ b/tests/Composer/Test/Fixtures/installer/circular-dependency-errors.test @@ -49,7 +49,7 @@ Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires requires/root 1.0.0 -> satisfiable by requires/root[1.0.0]. - - requires/root 1.0.0 requires root/pkg ^1.0 -> satisfiable by root/pkg[1.0.0] from package repo (defining 3 packages) but root/pkg is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance. + - requires/root 1.0.0 requires root/pkg ^1.0 -> satisfiable by root/pkg[1.0.0] from package repo (defining 3 packages) but root/pkg dev-master is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance. Problem 2 - Root composer.json requires requires/root2 1.0.0 -> satisfiable by requires/root2[1.0.0]. - requires/root2 1.0.0 requires root/pkg ^2.0 -> found root/pkg[dev-master] but it does not match the constraint. See https://getcomposer.org/dep-on-root for details and assistance.