From 12ed21705d4ad3feeb428e52540720177c3db65d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 22 Dec 2023 17:47:40 +0100 Subject: [PATCH] Check for non-platform requirements before warning that no deps are installed on show command, fixes #11760 --- src/Composer/Command/ShowCommand.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index ea5a9db3b..c2530c146 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -258,8 +258,16 @@ EOT }, $packages))]); } - if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) { - $io->writeError('No dependencies installed. Try running composer install or update.'); + if (!$installedRepo->getPackages()) { + $hasNonPlatformReqs = static function (array $reqs): bool { + return (bool) array_filter(array_keys($reqs), function (string $name) { + return !PlatformRepository::isPlatformPackage($name); + }); + }; + + if ($hasNonPlatformReqs($rootPkg->getRequires()) || $hasNonPlatformReqs($rootPkg->getDevRequires())) { + $io->writeError('No dependencies installed. Try running composer install or update.'); + } } }