1
0
Fork 0

Composer init - abandoned package warning

Added warning for abandoned packages in case more than one package is found for require / require-dev in composer init.
pull/6728/head
Arjan 2017-10-07 16:45:15 +02:00
parent e918ec9b39
commit a03efa2fda
1 changed files with 11 additions and 1 deletions

View File

@ -391,7 +391,17 @@ EOT
$exactMatch = null; $exactMatch = null;
$choices = array(); $choices = array();
foreach ($matches as $position => $foundPackage) { foreach ($matches as $position => $foundPackage) {
$choices[] = sprintf(' <info>%5s</info> %s', "[$position]", $foundPackage['name']); $abandoned = '';
if (isset($foundPackage['abandoned'])) {
if (is_string($foundPackage['abandoned'])) {
$replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
} else {
$replacement = 'No replacement was suggested';
}
$abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
}
$choices[] = sprintf(' <info>%5s</info> %s %s',"[$position]", $foundPackage['name'], $abandoned);
if ($foundPackage['name'] === $package) { if ($foundPackage['name'] === $package) {
$exactMatch = true; $exactMatch = true;
break; break;