1
0
Fork 0

Check whether remove command successfully removed the target packages, fixes #6998

pull/9285/head
Jordi Boggiano 2020-10-13 16:18:28 +02:00
parent 7ea6d5d2e7
commit 9ca7457698
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 12 additions and 3 deletions

View File

@ -209,9 +209,9 @@ EOT
'require' => $rootPackage->getRequires(),
'require-dev' => $rootPackage->getDevRequires(),
);
foreach ($toRemove as $type => $packages) {
foreach ($packages as $package) {
unset($links[$type][$package]);
foreach ($toRemove as $type => $names) {
foreach ($names as $name) {
unset($links[$type][$name]);
}
}
$rootPackage->setRequires($links['require']);
@ -266,6 +266,15 @@ EOT
file_put_contents($jsonFile->getPath(), $composerBackup);
}
if (!$dryRun) {
foreach ($packages as $package) {
if ($composer->getRepositoryManager()->getLocalRepository()->findPackages($package)) {
$io->writeError('<error>Removal failed, '.$package.' is still present, it may be required by another package. See `composer why '.$package.'`.</error>');
return 2;
}
}
}
return $status;
}
}