1
0
Fork 0

Support advisories from multiple repositories for the same package (#11436)

pull/11459/head
Dezső BICZÓ 2023-05-07 13:12:04 +00:00 committed by GitHub
parent 3bb191a464
commit 57a48df34e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -257,20 +257,18 @@ class RepositorySet
*/ */
private function getSecurityAdvisoriesForConstraints(array $packageConstraintMap, bool $allowPartialAdvisories): array private function getSecurityAdvisoriesForConstraints(array $packageConstraintMap, bool $allowPartialAdvisories): array
{ {
$advisories = []; $repoAdvisories = [];
foreach ($this->repositories as $repository) { foreach ($this->repositories as $repository) {
if (!$repository instanceof AdvisoryProviderInterface || !$repository->hasSecurityAdvisories()) { if (!$repository instanceof AdvisoryProviderInterface || !$repository->hasSecurityAdvisories()) {
continue; continue;
} }
$result = $repository->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories); $repoAdvisories[] = $repository->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories)['advisories'];
foreach ($result['namesFound'] as $nameFound) {
unset($packageConstraintMap[$nameFound]);
}
$advisories = array_merge($advisories, $result['advisories']);
} }
$advisories = array_merge_recursive([], ...$repoAdvisories);
ksort($advisories);
return $advisories; return $advisories;
} }