CodeExplorer getNextMajor example
foreach ($versions as $version) { $major =
$this->
getMajor($version);
if (!
isset($mappedVersions[$major])) { $mappedVersions[$major] =
[];
} $mappedVersions[$major][] =
$version;
} return [ ...
$mappedVersions[$this->
getNextMajor($currentVersion)] ??
[],
...
$mappedVersions[$this->
getMajor($currentVersion)] ??
[],
];
} private function getMajor(string
$version): string
{ $list =
explode('.',
$version, 3
);
return $list[0
] . '.' .
$list[1
];
}