diff --git a/src/Composer/Command/RemoveCommand.php b/src/Composer/Command/RemoveCommand.php
index c97130c3a..9646d6db1 100644
--- a/src/Composer/Command/RemoveCommand.php
+++ b/src/Composer/Command/RemoveCommand.php
@@ -94,12 +94,25 @@ EOT
if (isset($composer[$type][$package])) {
$json->removeLink($type, $composer[$type][$package]);
} elseif (isset($composer[$altType][$package])) {
- $io->writeError(''.$composer[$altType][$package].' could not be found in '.$type.' but it is present in '.$altType.'');
+ $io->writeError('' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '');
if ($io->isInteractive()) {
- if ($io->askConfirmation('Do you want to remove it from '.$altType.' [yes]? ', true)) {
+ if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [yes]? ', 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('' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '');
+ if ($io->isInteractive()) {
+ if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [yes]? ', true)) {
+ $json->removeLink($altType, $matchedPackage);
+ }
+ }
+ }
} else {
$io->writeError(''.$package.' is not required in your composer.json and has not been removed');
}