Skip to content

Commit e8ca032

Browse files
eliashaeusslernicolas-grekas
authored andcommitted
[Console] Harden array type for test-related user inputs
Inputs must be strings, otherwise they cannot be properly written to the `php://memory` stream. Using the hardened typed annotation, static code analyzers may assist developers in using correct array values.
1 parent 9e86767 commit e8ca032

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Symfony/Component/Console/Tester/TesterTrait.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
trait TesterTrait
2525
{
2626
private StreamOutput $output;
27+
28+
/**
29+
* @var list<string>
30+
*/
2731
private array $inputs = [];
2832
private bool $captureStreamsIndependently = false;
2933
private InputInterface $input;
@@ -107,8 +111,8 @@ public function assertCommandIsSuccessful(string $message = ''): void
107111
/**
108112
* Sets the user inputs.
109113
*
110-
* @param array $inputs An array of strings representing each input
111-
* passed to the command input stream
114+
* @param list<string> $inputs An array of strings representing each input
115+
* passed to the command input stream
112116
*
113117
* @return $this
114118
*/
@@ -161,6 +165,8 @@ private function initOutput(array $options): void
161165
}
162166

163167
/**
168+
* @param list<string> $inputs
169+
*
164170
* @return resource
165171
*/
166172
private static function createStream(array $inputs)

0 commit comments

Comments
 (0)