diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index c7497d390..f90b8160b 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -615,7 +615,11 @@ EOT $io->writeError('Everything up to date'); } } else { - $this->printPackages($io, $packages, $indent, $versionFits, $latestFits, $descriptionFits, $width, $versionLength, $nameLength, $latestLength); + if ($writeLatest && \count($packages) === 0) { + $io->writeError('All your direct dependencies are up to date'); + } else { + $this->printPackages($io, $packages, $indent, $versionFits, $latestFits, $descriptionFits, $width, $versionLength, $nameLength, $latestLength); + } } if ($showAllTypes) { diff --git a/tests/Composer/Test/Command/ShowCommandTest.php b/tests/Composer/Test/Command/ShowCommandTest.php index e34bb193b..ea1284f7c 100644 --- a/tests/Composer/Test/Command/ShowCommandTest.php +++ b/tests/Composer/Test/Command/ShowCommandTest.php @@ -123,6 +123,14 @@ outdated/major 1.0.0 ~ 2.0.0', ], ]; + yield 'outdated deps with --direct show msg if all up to date' => [ + ['command' => 'outdated', '--direct' => true], + 'All your direct dependencies are up to date', + [ + 'vendor/package' => '*', + ], + ]; + yield 'outdated deps with --major-only only shows major updates' => [ ['command' => 'outdated', '--major-only' => true], 'Legend: