1
0
Fork 0

Show warnings for each missing platform package in create-project, fixes #10736 (#12120)

pull/12129/head
Jordi Boggiano 2024-09-19 17:06:49 +02:00 committed by GitHub
parent a03331bd21
commit a5d0d73e00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -121,6 +121,7 @@ class VersionSelector
foreach ($candidates as $pkg) { foreach ($candidates as $pkg) {
$reqs = $pkg->getRequires(); $reqs = $pkg->getRequires();
$skip = false;
foreach ($reqs as $name => $link) { foreach ($reqs as $name => $link) {
if (!PlatformRepository::isPlatformPackage($name) || $platformRequirementFilter->isIgnored($name)) { if (!PlatformRepository::isPlatformPackage($name) || $platformRequirementFilter->isIgnored($name)) {
continue; continue;
@ -151,8 +152,8 @@ class VersionSelector
$isLatestVersion = !isset($alreadySeenNames[$pkg->getName()]); $isLatestVersion = !isset($alreadySeenNames[$pkg->getName()]);
$alreadySeenNames[$pkg->getName()] = true; $alreadySeenNames[$pkg->getName()] = true;
if ($io !== null && ($showWarnings === true || (is_callable($showWarnings) && $showWarnings($pkg)))) { if ($io !== null && ($showWarnings === true || (is_callable($showWarnings) && $showWarnings($pkg)))) {
$isFirstWarning = !isset($alreadyWarnedNames[$pkg->getName()]); $isFirstWarning = !isset($alreadyWarnedNames[$pkg->getName().'/'.$link->getTarget()]);
$alreadyWarnedNames[$pkg->getName()] = true; $alreadyWarnedNames[$pkg->getName().'/'.$link->getTarget()] = true;
$latest = $isLatestVersion ? "'s latest version" : ''; $latest = $isLatestVersion ? "'s latest version" : '';
$io->writeError( $io->writeError(
'<warning>Cannot use '.$pkg->getPrettyName().$latest.' '.$pkg->getPrettyVersion().' as it '.$link->getDescription().' '.$link->getTarget().' '.$link->getPrettyConstraint().' which '.$reason.'.</>', '<warning>Cannot use '.$pkg->getPrettyName().$latest.' '.$pkg->getPrettyVersion().' as it '.$link->getDescription().' '.$link->getTarget().' '.$link->getPrettyConstraint().' which '.$reason.'.</>',
@ -162,7 +163,11 @@ class VersionSelector
} }
// skip candidate // skip candidate
continue 2; $skip = true;
}
if ($skip) {
continue;
} }
$package = $pkg; $package = $pkg;