From a5d0d73e00ede9f0f46644123c8cf6881d81c7ec Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 19 Sep 2024 17:06:49 +0200 Subject: [PATCH] Show warnings for each missing platform package in create-project, fixes #10736 (#12120) --- src/Composer/Package/Version/VersionSelector.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Composer/Package/Version/VersionSelector.php b/src/Composer/Package/Version/VersionSelector.php index f1180c8e3..7c0c61a31 100644 --- a/src/Composer/Package/Version/VersionSelector.php +++ b/src/Composer/Package/Version/VersionSelector.php @@ -121,6 +121,7 @@ class VersionSelector foreach ($candidates as $pkg) { $reqs = $pkg->getRequires(); + $skip = false; foreach ($reqs as $name => $link) { if (!PlatformRepository::isPlatformPackage($name) || $platformRequirementFilter->isIgnored($name)) { continue; @@ -151,8 +152,8 @@ class VersionSelector $isLatestVersion = !isset($alreadySeenNames[$pkg->getName()]); $alreadySeenNames[$pkg->getName()] = true; if ($io !== null && ($showWarnings === true || (is_callable($showWarnings) && $showWarnings($pkg)))) { - $isFirstWarning = !isset($alreadyWarnedNames[$pkg->getName()]); - $alreadyWarnedNames[$pkg->getName()] = true; + $isFirstWarning = !isset($alreadyWarnedNames[$pkg->getName().'/'.$link->getTarget()]); + $alreadyWarnedNames[$pkg->getName().'/'.$link->getTarget()] = true; $latest = $isLatestVersion ? "'s latest version" : ''; $io->writeError( '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 - continue 2; + $skip = true; + } + + if ($skip) { + continue; } $package = $pkg;