1
0
Fork 0

Merge remote-tracking branch 'dmanners/remove-all-from-one-vendor'

pull/7806/head
Jordi Boggiano 2018-11-26 19:55:42 +01:00
commit dc6027a0ad
1 changed files with 15 additions and 2 deletions

View File

@ -94,12 +94,25 @@ EOT
if (isset($composer[$type][$package])) {
$json->removeLink($type, $composer[$type][$package]);
} elseif (isset($composer[$altType][$package])) {
$io->writeError('<warning>'.$composer[$altType][$package].' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
$io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
if ($io->isInteractive()) {
if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
$json->removeLink($altType, $composer[$altType][$package]);
}
}
} elseif (isset($composer[$type]) && $matches = preg_grep('#^'.$package.'#', array_keys($composer[$type]))) {
foreach ($matches as $matchedPackage) {
$json->removeLink($type, $matchedPackage);
}
} elseif (isset($composer[$altType]) && $matches = preg_grep('#^'.$package.'#', array_keys($composer[$altType]))) {
foreach ($matches as $matchedPackage) {
$io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
if ($io->isInteractive()) {
if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
$json->removeLink($altType, $matchedPackage);
}
}
}
} else {
$io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
}