1
0
Fork 0

Add non-zero return codes when why-not finds a reason a package is not installable, or when why finds no reason it is there, fixes #11796

pull/11842/head
Jordi Boggiano 2024-02-07 22:27:39 +01:00
parent 7cb92a90c8
commit 754f2868fb
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 4 additions and 1 deletions

View File

@ -133,6 +133,8 @@ abstract class BaseDependencyCommand extends BaseCommand
$renderTree = $input->getOption(self::OPTION_TREE);
$recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
$return = $inverted ? 1 : 0;
// Resolve dependencies
$results = $installedRepo->getDependents($needles, $constraint, $inverted, $recursive);
if (empty($results)) {
@ -142,6 +144,7 @@ abstract class BaseDependencyCommand extends BaseCommand
$needle,
$extra
));
$return = $inverted ? 0 : 1;
} elseif ($renderTree) {
$this->initStyles($output);
$root = $packages[0];
@ -171,7 +174,7 @@ abstract class BaseDependencyCommand extends BaseCommand
$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;
return $return;
}
/**