1
0
Fork 0

Fix problem output bug when purely numeric versions are condensed

pull/11601/head
Jordi Boggiano 2023-08-30 10:45:57 +02:00
parent 5062338079
commit 83792838c9
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 3 additions and 3 deletions

View File

@ -453,7 +453,7 @@ class Problem
} }
/** /**
* @param array<string, string> $versions an array of pretty versions, with normalized versions as keys * @param array<string|int, string> $versions an array of pretty versions, with normalized versions as keys
* @return list<string> a list of pretty versions and '...' where versions were removed * @return list<string> a list of pretty versions and '...' where versions were removed
*/ */
private static function condenseVersionList(array $versions, int $max, int $maxDev = 16): array private static function condenseVersionList(array $versions, int $max, int $maxDev = 16): array
@ -465,10 +465,10 @@ class Problem
$filtered = []; $filtered = [];
$byMajor = []; $byMajor = [];
foreach ($versions as $version => $pretty) { foreach ($versions as $version => $pretty) {
if (0 === stripos($version, 'dev-')) { if (0 === stripos((string) $version, 'dev-')) {
$byMajor['dev'][] = $pretty; $byMajor['dev'][] = $pretty;
} else { } else {
$byMajor[Preg::replace('{^(\d+)\..*}', '$1', $version)][] = $pretty; $byMajor[Preg::replace('{^(\d+)\..*}', '$1', (string) $version)][] = $pretty;
} }
} }
foreach ($byMajor as $majorVersion => $versionsForMajor) { foreach ($byMajor as $majorVersion => $versionsForMajor) {