minor #21876 Added setInputStream deprecation to UPGRADE guides (wouterj)

This PR was squashed before being merged into the 3.2 branch (closes #21876).

Discussion
----------

Added setInputStream deprecation to UPGRADE guides

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

The before/after examples of this deprecation is quite hard to figure out. Having them in the UPGRADE guides will significantly help the migration.

Commits
-------

6f53465648 Added setInputStream deprecation to UPGRADE guides
This commit is contained in:
Fabien Potencier 2017-03-05 08:44:07 -08:00
commit 28cf4ebdf2
2 changed files with 93 additions and 3 deletions

View File

@ -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
----

View File

@ -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
-----