Skip to content

Commit

Permalink
Add warning if old packages are required
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Aug 13, 2023
1 parent 5c4984f commit aeb7a1d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Composer/Service/ReplaceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ public function readBulks(): array
return $bulkReplacements;
}

/**
* @return string[]
*/
public function readRequires(): array
{
$jsonData = $this->getJsonData();
$requires = $jsonData['require'] ?? [];
return array_keys($requires);
}

/**
* @return ReplacementCollection
*/
Expand Down Expand Up @@ -285,6 +295,13 @@ public function getErrors(): array
$errors[] = $error;
}

$requires = $this->readRequires();
foreach ($this->suggestedBulks() as $bulkName) {
if (in_array($bulkName, $requires)) {
$errors[] = 'Bulk "'.$bulkName.'" should not be in "require" section but in "extra.replace.bulk"';
}
}

return $errors;
}

Expand Down

0 comments on commit aeb7a1d

Please sign in to comment.