From 2b86df40039e82f148bd50b47be4aa848a6ad107 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 7 Apr 2020 10:05:53 +0200 Subject: [PATCH] Add a hint about being on v2 when things go wrong --- .../DependencyResolver/SolverProblemsException.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Composer/DependencyResolver/SolverProblemsException.php b/src/Composer/DependencyResolver/SolverProblemsException.php index cfaa110c6..1dc5be5b8 100644 --- a/src/Composer/DependencyResolver/SolverProblemsException.php +++ b/src/Composer/DependencyResolver/SolverProblemsException.php @@ -59,6 +59,15 @@ class SolverProblemsException extends \RuntimeException $text .= "\nUse the option --with-all-dependencies to allow updates and removals for packages currently locked to specific versions."; } + // TODO remove before 2.0 final + if (!class_exists('PHPUnit\Framework\TestCase', false)) { + if (strpos($text, 'found composer-plugin-api[2.0.0] but it does not match')) { + $text .= "\nYou are using a snapshot build of Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report an issue to them to ask them to support Composer 2. To work around this you can run Composer with --ignore-platform-reqs, but this will also ignore your PHP version and may result in bigger problems down the line."; + } else { + $text .= "\nYou are using a snapshot build of Composer 2, which may be the cause of the problem. Run `composer self-update --stable` and then try again. In case it solves the problem, please report an issue mentioning Composer 2."; + } + } + return $text; }