From 137ec17c0a9288bf4bc3bda55af149173db461e0 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 10 Jun 2024 11:37:52 +0200 Subject: [PATCH] Fix empty type support in init command, fixes #11999 --- src/Composer/Command/InitCommand.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 5f6773daf..81233a084 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -378,11 +378,14 @@ EOT ); $input->setOption('stability', $minimumStability); - $type = $input->getOption('type') ?: false; + $type = $input->getOption('type'); $type = $io->ask( 'Package Type (e.g. library, project, metapackage, composer-plugin) ['.$type.']: ', $type ); + if ($type === '' || $type === false) { + $type = null; + } $input->setOption('type', $type); if (null === $license = $input->getOption('license')) {