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:
commit
28cf4ebdf2
@ -11,6 +11,51 @@ Console
|
|||||||
|
|
||||||
* Setting unknown style options is deprecated and will throw an exception in
|
* Setting unknown style options is deprecated and will throw an exception in
|
||||||
Symfony 4.0.
|
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
|
DependencyInjection
|
||||||
-------------------
|
-------------------
|
||||||
@ -21,9 +66,9 @@ DependencyInjection
|
|||||||
ExpressionLanguage
|
ExpressionLanguage
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
* Passing a `ParserCacheInterface` instance to the `ExpressionLanguage` has been
|
* Passing a `ParserCacheInterface` instance to the `ExpressionLanguage` has been
|
||||||
deprecated and will not be supported in Symfony 4.0. You should use the
|
deprecated and will not be supported in Symfony 4.0. You should use the
|
||||||
`CacheItemPoolInterface` interface instead.
|
`CacheItemPoolInterface` interface instead.
|
||||||
|
|
||||||
Form
|
Form
|
||||||
----
|
----
|
||||||
|
@ -6,6 +6,51 @@ Console
|
|||||||
|
|
||||||
* Setting unknown style options is not supported anymore and throws an
|
* Setting unknown style options is not supported anymore and throws an
|
||||||
exception.
|
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
|
Debug
|
||||||
-----
|
-----
|
||||||
|
Reference in New Issue
Block a user