From 66bf6d31c36c06919523fb2b5d5fe3088c809010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antal=20=C3=81ron?= Date: Thu, 3 Oct 2024 16:19:38 +0200 Subject: [PATCH] Allow init without license (#12145) --- src/Composer/Command/InitCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 71dd83f53..6d7311dd4 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -400,7 +400,7 @@ EOT $license ); $spdx = new SpdxLicenses(); - if (!$spdx->validate($license) && $license !== 'proprietary') { + if (null !== $license && !$spdx->validate($license) && $license !== 'proprietary') { throw new \InvalidArgumentException('Invalid license provided: '.$license.'. Only SPDX license identifiers (https://spdx.org/licenses/) or "proprietary" are accepted.'); } $input->setOption('license', $license);