File tree Expand file tree Collapse file tree 3 files changed +34
-6
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 3 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -364,13 +364,15 @@ function header_register_callback(callable $callback): bool {}
364364function register_tick_function(callable $callback, mixed ...$args): bool {}
365365
366366/**
367- * @param string|array<string> $command
368- * @param list<list<string>|resource> $descriptor_spec
369- * @param array<resource> $pipes
370- * @param array<mixed> $env_vars
367+ * @template P of int = int
368+ *
369+ * @param string|list<string> $command
370+ * @param array<P, list<string>|resource> $descriptor_spec
371+ * @param array<mixed> $pipes
372+ * @param array<string, mixed> $env_vars
371373 * @param array<string, bool> $options
372374 *
373- * @param-out list< resource> $pipes
375+ * @param-out array<P, resource> $pipes
374376 *
375377 * @return resource|false
376378 */
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ function execute(string $command): ?array
2525 $ pipes
2626 );
2727
28- assertType ('list< resource> ' , $ pipes );
28+ assertType ('array<0|1|2, resource> ' , $ pipes );
2929
3030 if (!is_resource ($ process )) {
3131 return null ;
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug13197b ;
4+
5+ use function PHPStan \Testing \assertType ;
6+
7+ function execute (string $ command ): void
8+ {
9+ if (!function_exists ('proc_open ' )) {
10+ return ;
11+ }
12+
13+ $ pipes = [];
14+
15+ $ process = @proc_open (
16+ $ command ,
17+ [
18+ ['pipe ' , 'rb ' ],
19+ 3 => ['pipe ' , 'wb ' ], // stdout
20+ 5 => ['pipe ' , 'wb ' ], // stderr
21+ ],
22+ $ pipes
23+ );
24+
25+ assertType ('array<0|3|5, resource> ' , $ pipes );
26+ }
You can’t perform that action at this time.
0 commit comments