10000 minor #21876 Added setInputStream deprecation to UPGRADE guides (wout… · symfony/symfony@28cf4eb · GitHub
[go: up one dir, main page]

Skip to content

Commit 28cf4eb

Browse files
committed
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 ------- 6f53465 Added setInputStream deprecation to UPGRADE guides
2 parents d0ac91a + 6f53465 commit 28cf4eb

File tree

2 files changed

+93
-3
lines changed

2 files changed

+93
-3
lines changed

UPGRADE-3.2.md

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,51 @@ Console
1111

1212
* Setting unknown style options is deprecated and will throw an exception in
1313
Symfony 4.0.
14+
* The `QuestionHelper::setInputStream()` method is deprecated and will be
15+
removed in Symfony 4.0. Use `StreamableInputInterface::setStream()` or
16+
`CommandTester::setInputs()` instead.
17+
18+
Before:
19+
20+
```php
21+
$input = new ArrayInput();
22+
23+
$questionHelper->setInputStream($stream);
24+
$questionHelper->ask($input, $output, $question);
25+
```
26+
27+
After:
28+
29+
```php
30+
$input = new ArrayInput();
31+
$input->setStream($stream);
32+
33+
$questionHelper->ask($input, $output, $question);
34+
```
35+
36+
Before:
37+
38+
```php
39+
$commandTester = new CommandTester($command);
40+
41+
$stream = fopen('php://memory', 'r+', false);
42+
fputs($stream, "AppBundle\nYes");
43+
rewind($stream);
44+
45+
$command->getHelper('question')->setInputStream($stream);
46+
47+
$commandTester->execute();
48+
```
49+
50+
After:
51+
52+
```php
53+
$commandTester = new CommandTester($command);
54+
55+
$commandTester->setInputs(array('AppBundle', 'Yes'));
56+
57+
$commandTester->execute();
58+
```
1459

1560
DependencyInjection
1661
-------------------
@@ -21,9 +66,9 @@ DependencyInjection
2166
ExpressionLanguage
2267
-------------------
2368

24-
* Passing a `ParserCacheInterface` instance to the `ExpressionLanguage` has been
25-
deprecated and will not be supported in Symfony 4.0. You should use the
26-
`CacheItemPoolInterface` interface instead.
69+
* Passing a `ParserCacheInterface` instance to the `ExpressionLanguage` has been
70+
deprecated and will not be supported in Symfony 4.0. You should use the
71+
`CacheItemPoolInterface` interface instead.
2772

2873
Form
2974
----

UPGRADE-4.0.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,51 @@ Console
66

77
* Setting unknown style options is not supported anymore and throws an
88
exception.
9+
* The `QuestionHelper::setInputStream()` method is removed. Use
10+
`StreamableInputInterface::setStream()` or `CommandTester::setInputs()`
11+
instead.
12+
13+
Before:
14+
15+
```php
16+
$input = new ArrayInput();
17+
18+
$questionHelper->setInputStream($stream);
19+
$questionHelper->ask($input, $output, $question);
20+
```
21+
22+
After:
23+
24+
```php
25+
$input = new ArrayInput();
26+
$input->setStream($stream);
27+
28+
$questionHelper->ask($input, $output, $question);
29+
```
30+
31+
Before:
32+
33+
```php
34+
$commandTester = new CommandTester($command);
35+
36+
$stream = fopen('php://memory', 'r+', false);
37+
fputs($stream, "AppBundle\nYes");
38+
rewind($stream);
39+
40+
$command->getHelper('question')->setInputStream($stream);
41+
42+
$commandTester->execute();
43+
```
44+
45+
After:
46+
47+
```php
48+
$commandTester = new CommandTester($command);
49+
50+
$commandTester->setInputs(array('AppBundle', 'Yes'));
51+
52+
$commandTester->execute();
53+
```
954

1055
Debug
1156
-----

0 commit comments

Comments
 (0)
0