From a88d7bdd2f6c1a87ff6034001617d2e51397830c Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Mon, 23 Jun 2025 10:39:46 +0200 Subject: [PATCH] Make `$input` argument for `CommandTester` optional Why require an input to be passed when none is needed? --- src/Symfony/Component/Console/CHANGELOG.md | 1 + src/Symfony/Component/Console/Tester/CommandTester.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/CHANGELOG.md b/src/Symfony/Component/Console/CHANGELOG.md index 722045091ff49..81f0e330206d3 100644 --- a/src/Symfony/Component/Console/CHANGELOG.md +++ b/src/Symfony/Component/Console/CHANGELOG.md @@ -10,6 +10,7 @@ CHANGELOG * Add `BackedEnum` support with `#[Argument]` and `#[Option]` inputs in invokable commands * Allow Usages to be specified via `#[AsCommand]` attribute. * Allow passing invokable commands to `Symfony\Component\Console\Tester\CommandTester` + * Make `$input` argument for `Symfony\Component\Console\Tester\CommandTester` optional 7.3 --- diff --git a/src/Symfony/Component/Console/Tester/CommandTester.php b/src/Symfony/Component/Console/Tester/CommandTester.php index 714d88ad51dea..106c0268ec0bd 100644 --- a/src/Symfony/Component/Console/Tester/CommandTester.php +++ b/src/Symfony/Component/Console/Tester/CommandTester.php @@ -47,7 +47,7 @@ public function __construct( * * @return int The command exit code */ - public function execute(array $input, array $options = []): int + public function execute(array $input = [], array $options = []): int { // set the command name automatically if the application requires // this argument and no command name was passed