diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index cbd43e5dc..5f257829b 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -496,6 +496,38 @@ class Installer $devPackages = null; } + if ($operations) { + $installs = $updates = $uninstalls = array(); + foreach ($operations as $operation) { + if ($operation instanceof InstallOperation) { + $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion(); + } elseif ($operation instanceof UpdateOperation) { + $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion(); + } elseif ($operation instanceof UninstallOperation) { + $uninstalls[] = $operation->getPackage()->getPrettyName(); + } + } + + $this->io->writeError( + sprintf("Package operations: %d install%s, %d update%s, %d removal%s", + count($installs), + 1 === count($installs) ? '' : 's', + count($updates), + 1 === count($updates) ? '' : 's', + count($uninstalls), + 1 === count($uninstalls) ? '' : 's') + ); + if ($installs) { + $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE); + } + if ($updates) { + $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE); + } + if ($uninstalls) { + $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE); + } + } + foreach ($operations as $operation) { // collect suggestions if ('install' === $operation->getJobType()) { diff --git a/tests/Composer/Test/Fixtures/installer/abandoned-listed.test b/tests/Composer/Test/Fixtures/installer/abandoned-listed.test index bc8a0cdb6..7eba0a6f0 100644 --- a/tests/Composer/Test/Fixtures/installer/abandoned-listed.test +++ b/tests/Composer/Test/Fixtures/installer/abandoned-listed.test @@ -26,6 +26,7 @@ install --EXPECT-OUTPUT-- Loading composer repositories with package information Updating dependencies (including require-dev) +Package operations: 2 installs, 0 updates, 0 removals Package a/a is abandoned, you should avoid using it. No replacement was suggested. Package c/c is abandoned, you should avoid using it. Use b/b instead. Writing lock file diff --git a/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test b/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test index 29fc0d38f..d807c6df8 100644 --- a/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test +++ b/tests/Composer/Test/Fixtures/installer/github-issues-4795-2.test @@ -36,6 +36,7 @@ update a b --with-dependencies --EXPECT-OUTPUT-- Loading composer repositories with package information Updating dependencies (including require-dev) +Package operations: 0 installs, 2 updates, 0 removals Writing lock file Generating autoload files diff --git a/tests/Composer/Test/Fixtures/installer/suggest-installed.test b/tests/Composer/Test/Fixtures/installer/suggest-installed.test index df573c997..198203ce9 100644 --- a/tests/Composer/Test/Fixtures/installer/suggest-installed.test +++ b/tests/Composer/Test/Fixtures/installer/suggest-installed.test @@ -21,6 +21,7 @@ install --EXPECT-OUTPUT-- Loading composer repositories with package information Updating dependencies (including require-dev) +Package operations: 2 installs, 0 updates, 0 removals Writing lock file Generating autoload files diff --git a/tests/Composer/Test/Fixtures/installer/suggest-prod.test b/tests/Composer/Test/Fixtures/installer/suggest-prod.test index 0fe9c8853..40546f8d0 100644 --- a/tests/Composer/Test/Fixtures/installer/suggest-prod.test +++ b/tests/Composer/Test/Fixtures/installer/suggest-prod.test @@ -19,6 +19,7 @@ install --no-dev --EXPECT-OUTPUT-- Loading composer repositories with package information Updating dependencies +Package operations: 1 install, 0 updates, 0 removals Writing lock file Generating autoload files diff --git a/tests/Composer/Test/Fixtures/installer/suggest-replaced.test b/tests/Composer/Test/Fixtures/installer/suggest-replaced.test index 38755d7fb..f18054d74 100644 --- a/tests/Composer/Test/Fixtures/installer/suggest-replaced.test +++ b/tests/Composer/Test/Fixtures/installer/suggest-replaced.test @@ -21,6 +21,7 @@ install --EXPECT-OUTPUT-- Loading composer repositories with package information Updating dependencies (including require-dev) +Package operations: 2 installs, 0 updates, 0 removals Writing lock file Generating autoload files diff --git a/tests/Composer/Test/Fixtures/installer/suggest-uninstalled.test b/tests/Composer/Test/Fixtures/installer/suggest-uninstalled.test index fda020699..ae5ff36e3 100644 --- a/tests/Composer/Test/Fixtures/installer/suggest-uninstalled.test +++ b/tests/Composer/Test/Fixtures/installer/suggest-uninstalled.test @@ -19,6 +19,7 @@ install --EXPECT-OUTPUT-- Loading composer repositories with package information Updating dependencies (including require-dev) +Package operations: 1 install, 0 updates, 0 removals a/a suggests installing b/b (an obscure reason) Writing lock file Generating autoload files