Skip to content

Commit

Permalink
Add the actual fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed Apr 8, 2022
1 parent 28e5d6b commit 2d97668
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/ListFilterer/DevDepsOnlyFilterer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@ public function filter(array $list): array
foreach ($list as $delta => $item) {
$type = $this->getRequireTypeInComposerJsonForPackage($item->name);
if (!$type) {
continue;
// Meaning this is actually not in composer.json. Which could mean it's an indirect dependency. But is
// it a dependency of a dev dependency?
$packages = $this->findRequiresForPackage($item);
$has_non_dev = false;
foreach ($packages as $package) {
$parent_type = $this->getRequireTypeInComposerJsonForPackage($package->name);
if ($parent_type === FilterInterface::REQUIRE_TYPE_REQUIRE) {
$has_non_dev = true;
break;
}
}
if (!$has_non_dev) {
unset($list[$delta]);
}
}
if ($type === FilterInterface::REQUIRE_TYPE_REQUIRE_DEV) {
unset($list[$delta]);
Expand Down

0 comments on commit 2d97668

Please sign in to comment.