From 3cfd9bf51bd7afba0a339edb29f0b3a0eb23c554 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 19 Dec 2023 15:51:39 +0100 Subject: [PATCH] Ensure composer.json gets deleted after a dry run require, fixes #11747 --- src/Composer/Command/RequireCommand.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index 658d58de3..4a8a47559 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -349,6 +349,10 @@ EOT } throw $e; } finally { + if ($input->getOption('dry-run') && $this->newlyCreated) { + @unlink($this->json->getPath()); + } + $signalHandler->unregister(); } }