Skip to content

Commit

Permalink
Fix issue in remove command when allow-plugins is not present at all, f…
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek authored and emahorvat52 committed Jan 18, 2023
1 parent 5e9759d commit ff3373b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Composer/Command/RemoveCommand.php
Expand Up @@ -235,8 +235,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);

$allowPlugins = $composer->getConfig()->get('allow-plugins');
$removedPlugins = array_intersect(array_keys($allowPlugins), $packages);
if (!$dryRun && count($removedPlugins) !== 0) {
$removedPlugins = is_array($allowPlugins) ? array_intersect(array_keys($allowPlugins), $packages) : [];
if (!$dryRun && count($removedPlugins) > 0) {
if (count($allowPlugins) === count($removedPlugins)) {
$json->removeConfigSetting('allow-plugins');
} else {
Expand Down

0 comments on commit ff3373b

Please sign in to comment.