Improved output of SuggestsCommand by correctly filtering installed platform requirements if suggested.
parent
1b97d07bca
commit
b20cc22ebb
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace Composer\Command;
|
namespace Composer\Command;
|
||||||
|
|
||||||
|
use Composer\Repository\PlatformRepository;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
@ -75,6 +76,9 @@ EOT
|
||||||
$installed = array_flip($installed);
|
$installed = array_flip($installed);
|
||||||
ksort($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
|
// Next gather all suggestions that are not in that list
|
||||||
$suggesters = array();
|
$suggesters = array();
|
||||||
$suggested = array();
|
$suggested = array();
|
||||||
|
@ -84,6 +88,8 @@ EOT
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($package['suggest'] as $suggestion => $reason) {
|
foreach ($package['suggest'] as $suggestion => $reason) {
|
||||||
|
if (false === strpos('/', $suggestion) && !is_null($platform->findPackage($suggestion, '*')))
|
||||||
|
continue;
|
||||||
if (!isset($installed[$suggestion])) {
|
if (!isset($installed[$suggestion])) {
|
||||||
$suggesters[$packageName][$suggestion] = $reason;
|
$suggesters[$packageName][$suggestion] = $reason;
|
||||||
$suggested[$suggestion][$packageName] = $reason;
|
$suggested[$suggestion][$packageName] = $reason;
|
||||||
|
|
Loading…
Reference in New Issue