From 6f53465648544a0cf648c84e50083a119fbab723 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 5 Mar 2017 13:22:56 +0100 Subject: [PATCH] Added setInputStream deprecation to UPGRADE guides --- UPGRADE-3.2.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++--- UPGRADE-4.0.md | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 3 deletions(-) diff --git a/UPGRADE-3.2.md b/UPGRADE-3.2.md index d5abb75854..17ae97d1ce 100644 --- a/UPGRADE-3.2.md +++ b/UPGRADE-3.2.md @@ -11,6 +11,51 @@ Console * Setting unknown style options is deprecated and will throw an exception in Symfony 4.0. + * The `QuestionHelper::setInputStream()` method is deprecated and will be + removed in Symfony 4.0. Use `StreamableInputInterface::setStream()` or + `CommandTester::setInputs()` instead. + + Before: + + ```php + $input = new ArrayInput(); + + $questionHelper->setInputStream($stream); + $questionHelper->ask($input, $output, $question); + ``` + + After: + + ```php + $input = new ArrayInput(); + $input->setStream($stream); + + $questionHelper->ask($input, $output, $question); + ``` + + Before: + + ```php + $commandTester = new CommandTester($command); + + $stream = fopen('php://memory', 'r+', false); + fputs($stream, "AppBundle\nYes"); + rewind($stream); + + $command->getHelper('question')->setInputStream($stream); + + $commandTester->execute(); + ``` + + After: + + ```php + $commandTester = new CommandTester($command); + + $commandTester->setInputs(array('AppBundle', 'Yes')); + + $commandTester->execute(); + ``` DependencyInjection ------------------- @@ -21,9 +66,9 @@ DependencyInjection ExpressionLanguage ------------------- -* Passing a `ParserCacheInterface` instance to the `ExpressionLanguage` has been - deprecated and will not be supported in Symfony 4.0. You should use the - `CacheItemPoolInterface` interface instead. + * Passing a `ParserCacheInterface` instance to the `ExpressionLanguage` has been + deprecated and will not be supported in Symfony 4.0. You should use the + `CacheItemPoolInterface` interface instead. Form ---- diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index cc7584de70..d8bc05d4c9 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -6,6 +6,51 @@ Console * Setting unknown style options is not supported anymore and throws an exception. + * The `QuestionHelper::setInputStream()` method is removed. Use + `StreamableInputInterface::setStream()` or `CommandTester::setInputs()` + instead. + + Before: + + ```php + $input = new ArrayInput(); + + $questionHelper->setInputStream($stream); + $questionHelper->ask($input, $output, $question); + ``` + + After: + + ```php + $input = new ArrayInput(); + $input->setStream($stream); + + $questionHelper->ask($input, $output, $question); + ``` + + Before: + + ```php + $commandTester = new CommandTester($command); + + $stream = fopen('php://memory', 'r+', false); + fputs($stream, "AppBundle\nYes"); + rewind($stream); + + $command->getHelper('question')->setInputStream($stream); + + $commandTester->execute(); + ``` + + After: + + ```php + $commandTester = new CommandTester($command); + + $commandTester->setInputs(array('AppBundle', 'Yes')); + + $commandTester->execute(); + ``` Debug -----