diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index d069da03bc..bd340d3078 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -859,10 +859,6 @@ class Application // ignore invalid options/arguments for now, to allow the event listeners to customize the InputDefinition } - // don't bind the input again as it would override any input argument/option set from the command event in - // addition to being useless - $command->setInputBound(true); - $event = new ConsoleCommandEvent($command, $input, $output); $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event); diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index fd0376c22d..39a1f6e844 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -42,7 +42,6 @@ class Command private $ignoreValidationErrors = false; private $applicationDefinitionMerged = false; private $applicationDefinitionMergedWithArgs = false; - private $inputBound = false; private $code; private $synopsis = array(); private $usages = array(); @@ -219,13 +218,11 @@ class Command $this->mergeApplicationDefinition(); // bind the input against the command specific arguments/options - if (!$this->inputBound) { - try { - $input->bind($this->definition); - } catch (ExceptionInterface $e) { - if (!$this->ignoreValidationErrors) { - throw $e; - } + try { + $input->bind($this->definition); + } catch (ExceptionInterface $e) { + if (!$this->ignoreValidationErrors) { + throw $e; } } @@ -681,14 +678,6 @@ class Command return $output->fetch(); } - /** - * @internal - */ - public function setInputBound($inputBound) - { - $this->inputBound = $inputBound; - } - /** * Validates a command name. * diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index ab66b63629..5c195e8a36 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -1117,31 +1117,6 @@ class ApplicationTest extends TestCase $this->assertEquals('some test value', $extraValue); } - public function testUpdateInputFromConsoleCommandEvent() - { - $dispatcher = $this->getDispatcher(); - $dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) { - $event->getInput()->setOption('extra', 'overriden'); - }); - - $application = new Application(); - $application->setDispatcher($dispatcher); - $application->setAutoExit(false); - - $application - ->register('foo') - ->addOption('extra', null, InputOption::VALUE_REQUIRED) - ->setCode(function (InputInterface $input, OutputInterface $output) { - $output->write('foo.'); - }) - ; - - $tester = new ApplicationTester($application); - $tester->run(array('command' => 'foo', '--extra' => 'original')); - - $this->assertEquals('overriden', $tester->getInput()->getOption('extra')); - } - public function testTerminalDimensions() { $application = new Application();