1
0
Fork 0

Do not read require-dev except for the root package when sorting packages

pull/10617/head
Jordi Boggiano 2022-03-15 11:03:53 +01:00
parent 890b8fad3d
commit d67953266f
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 6 additions and 1 deletions

View File

@ -13,6 +13,7 @@
namespace Composer\Util; namespace Composer\Util;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface;
class PackageSorter class PackageSorter
{ {
@ -29,7 +30,11 @@ class PackageSorter
$usageList = array(); $usageList = array();
foreach ($packages as $package) { 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(); $target = $link->getTarget();
$usageList[$target][] = $package->getName(); $usageList[$target][] = $package->getName();
} }