Skip to content

Commit

Permalink
Do not read require-dev except for the root package when sorting pack…
Browse files Browse the repository at this point in the history
…ages
  • Loading branch information
Seldaek committed Mar 15, 2022
1 parent 890b8fa commit d679532
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Composer/Util/PackageSorter.php
Expand Up @@ -13,6 +13,7 @@
namespace Composer\Util;

use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface;

class PackageSorter
{
Expand All @@ -29,7 +30,11 @@ public static function sortPackages(array $packages)
$usageList = array();

foreach ($packages as $package) {
foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
$links = $package->getRequires();
if ($package instanceof RootPackageInterface) {
$links = array_merge($links, $package->getDevRequires());
}
foreach ($links as $link) {
$target = $link->getTarget();
$usageList[$target][] = $package->getName();
}
Expand Down

0 comments on commit d679532

Please sign in to comment.