Suggest running 'require' not 'update' if a root req fails to update (#11691)
parent
03085c8181
commit
81b662d388
|
@ -152,7 +152,23 @@ abstract class BaseDependencyCommand extends BaseCommand
|
|||
}
|
||||
|
||||
if ($inverted && $input->hasArgument(self::ARGUMENT_CONSTRAINT)) {
|
||||
$this->getIO()->writeError('Not finding what you were looking for? Try calling `composer update "'.$input->getArgument(self::ARGUMENT_PACKAGE).':'.$input->getArgument(self::ARGUMENT_CONSTRAINT).'" --dry-run` to get another view on the problem.');
|
||||
$composerCommand = 'update';
|
||||
|
||||
foreach ($composer->getPackage()->getRequires() as $rootRequirement) {
|
||||
if ($rootRequirement->getTarget() === $needle) {
|
||||
$composerCommand = 'require';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($composer->getPackage()->getDevRequires() as $rootRequirement) {
|
||||
if ($rootRequirement->getTarget() === $needle) {
|
||||
$composerCommand = 'require --dev';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->getIO()->writeError('Not finding what you were looking for? Try calling `composer '.$composerCommand.' "'.$needle.':'.$textConstraint.'" --dry-run` to get another view on the problem.');
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -425,7 +425,7 @@ OUTPUT
|
|||
<<<OUTPUT
|
||||
Package "vendor1/package1" could not be found with constraint "3.*", results below will most likely be incomplete.
|
||||
__root__ - requires vendor1/package1 (1.*)
|
||||
Not finding what you were looking for? Try calling `composer update "vendor1/package1:3.*" --dry-run` to get another view on the problem.
|
||||
Not finding what you were looking for? Try calling `composer require "vendor1/package1:3.*" --dry-run` to get another view on the problem.
|
||||
OUTPUT
|
||||
];
|
||||
|
||||
|
@ -434,7 +434,7 @@ OUTPUT
|
|||
<<<OUTPUT
|
||||
Package "vendor1/package1" could not be found with constraint "^1.4", results below will most likely be incomplete.
|
||||
There is no installed package depending on "vendor1/package1" in versions not matching ^1.4
|
||||
Not finding what you were looking for? Try calling `composer update "vendor1/package1:^1.4" --dry-run` to get another view on the problem.
|
||||
Not finding what you were looking for? Try calling `composer require "vendor1/package1:^1.4" --dry-run` to get another view on the problem.
|
||||
OUTPUT
|
||||
];
|
||||
|
||||
|
@ -442,7 +442,7 @@ OUTPUT
|
|||
['package' => 'vendor1/package1', 'version' => '^1.3'],
|
||||
<<<OUTPUT
|
||||
There is no installed package depending on "vendor1/package1" in versions not matching ^1.3
|
||||
Not finding what you were looking for? Try calling `composer update "vendor1/package1:^1.3" --dry-run` to get another view on the problem.
|
||||
Not finding what you were looking for? Try calling `composer require "vendor1/package1:^1.3" --dry-run` to get another view on the problem.
|
||||
OUTPUT
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue