From b20cc22ebb1d9f8ed467f0ea353391be7442ad3d Mon Sep 17 00:00:00 2001 From: Niels Keurentjes Date: Wed, 3 Feb 2016 00:14:16 +0100 Subject: [PATCH] Improved output of SuggestsCommand by correctly filtering installed platform requirements if suggested. --- src/Composer/Command/SuggestsCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Composer/Command/SuggestsCommand.php b/src/Composer/Command/SuggestsCommand.php index 35d5e01a3..4ccb44853 100644 --- a/src/Composer/Command/SuggestsCommand.php +++ b/src/Composer/Command/SuggestsCommand.php @@ -12,6 +12,7 @@ namespace Composer\Command; +use Composer\Repository\PlatformRepository; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -75,6 +76,9 @@ EOT $installed = array_flip($installed); ksort($installed); + // Init platform repo + $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array()); + // Next gather all suggestions that are not in that list $suggesters = array(); $suggested = array(); @@ -84,6 +88,8 @@ EOT continue; } foreach ($package['suggest'] as $suggestion => $reason) { + if (false === strpos('/', $suggestion) && !is_null($platform->findPackage($suggestion, '*'))) + continue; if (!isset($installed[$suggestion])) { $suggesters[$packageName][$suggestion] = $reason; $suggested[$suggestion][$packageName] = $reason;