From f1e3ba74abf39791f0dc9b7e0c6492b40685e1d8 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 30 Mar 2022 18:10:07 +0200 Subject: [PATCH] Allow passing null to $prettyVersion to handle gracefully cases where a version could not be parsed upstream, refs #10631 --- src/Composer/Repository/PlatformRepository.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 6cac92bec4a8..bce36fc809a9 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -659,15 +659,18 @@ private function buildPackageName(string $name): string /** * @param string $name - * @param string $prettyVersion + * @param string|null $prettyVersion * @param string|null $description * @param string[] $replaces * @param string[] $provides * * @return void */ - private function addLibrary(string $name, string $prettyVersion, ?string $description = null, array $replaces = array(), array $provides = array()): void + private function addLibrary(string $name, ?string $prettyVersion, ?string $description = null, array $replaces = array(), array $provides = array()): void { + if (null === $prettyVersion) { + return; + } try { $version = $this->versionParser->normalize($prettyVersion); } catch (\UnexpectedValueException $e) {