Display error instead of throwing exception when unable to update with temporary constraint (#11692)
parent
23be508ea5
commit
8c0f1e10dc
|
@ -160,7 +160,9 @@ EOT
|
|||
$parsedConstraint = $parser->parseConstraints($constraint);
|
||||
$temporaryConstraints[$package] = $parsedConstraint;
|
||||
if (isset($rootRequirements[$package]) && !Intervals::haveIntersections($parsedConstraint, $rootRequirements[$package]->getConstraint())) {
|
||||
throw new \InvalidArgumentException('The temporary constraint "'.$constraint.'" for "'.$package.'" must be a subset of the constraint in your composer.json ('.$rootRequirements[$package]->getPrettyConstraint().')');
|
||||
$io->writeError('<error>The temporary constraint "'.$constraint.'" for "'.$package.'" must be a subset of the constraint in your composer.json ('.$rootRequirements[$package]->getPrettyConstraint().')</error>');
|
||||
$io->write('<info>Run `composer require '.$package.'` or `composer require '.$package.':'.$constraint.'` instead to replace the constraint</info>');
|
||||
return self::FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,15 @@ Your requirements could not be resolved to an installable set of packages.
|
|||
Problem 1
|
||||
- Root composer.json requires root/req 1.* -> satisfiable by root/req[1.0.0].
|
||||
- root/req 1.0.0 requires dep/pkg ^1 -> found dep/pkg[1.0.0, 1.0.1, 1.0.2] but it conflicts with your temporary update constraint (dep/pkg:^2).
|
||||
OUTPUT
|
||||
];
|
||||
|
||||
yield 'update with temporary constraint failing resolution on root package' => [
|
||||
$rootDepAndTransitiveDep,
|
||||
['--with' => ['root/req:^2']],
|
||||
<<<OUTPUT
|
||||
The temporary constraint "^2" for "root/req" must be a subset of the constraint in your composer.json (1.*)
|
||||
Run `composer require root/req` or `composer require root/req:^2` instead to replace the constraint
|
||||
OUTPUT
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue