@@ -22,7 +22,20 @@ class Stdio extends EventEmitter implements DuplexStreamInterface
22
22
private $ incompleteLine = '' ;
23
23
private $ originalTtyMode = null ;
24
24
25
- public function __construct (LoopInterface $ loop , ReadableStreamInterface $ input = null , WritableStreamInterface $ output = null , Readline $ readline = null )
25
+ /**
26
+ *
27
+ * This class takes an optional `LoopInterface|null $loop` parameter that can be used to
28
+ * pass the event loop instance to use for this object. You can use a `null` value
29
+ * here in order to use the [default loop](https://github.com/reactphp/event-loop#loop).
30
+ * This value SHOULD NOT be given unless you're sure you want to explicitly use a
31
+ * given event loop instance.
32
+ *
33
+ * @param ?LoopInterface $loop
34
+ * @param ?ReadableStreamInterface $input
35
+ * @param ?WritableStreamInterface $output
36
+ * @param ?Readline $readline
37
+ */
38
+ public function __construct (LoopInterface $ loop = null , ReadableStreamInterface $ input = null , WritableStreamInterface $ output = null , Readline $ readline = null )
26
39
{
27
40
if ($ input === null ) {
28
41
$ input = $ this ->createStdin ($ loop ); // @codeCoverageIgnore
@@ -529,11 +542,11 @@ private function restoreTtyMode()
529
542
}
530
543
531
544
/**
532
- * @param LoopInterface $loop
545
+ * @param ? LoopInterface $loop
533
546
* @return ReadableStreamInterface
534
547
* @codeCoverageIgnore this is covered by functional tests with/without ext-readline
535
548
*/
536
- private function createStdin (LoopInterface $ loop )
549
+ private function createStdin (LoopInterface $ loop = null )
537
550
{
538
551
// STDIN not defined ("php -a") or already closed (`fclose(STDIN)`)
539
552
// also support starting program with closed STDIN ("example.php 0<&-")
@@ -569,11 +582,11 @@ private function createStdin(LoopInterface $loop)
569
582
}
570
583
571
584
/**
572
- * @param LoopInterface $loop
585
+ * @param ? LoopInterface $loop
573
586
* @return WritableStreamInterface
574
587
* @codeCoverageIgnore this is covered by functional tests
575
588
*/
576
- private function createStdout (LoopInterface $ loop )
589
+ private function createStdout (LoopInterface $ loop = null )
577
590
{
578
591
// STDOUT not defined ("php -a") or already closed (`fclose(STDOUT)`)
579
592
// also support starting program with closed STDOUT ("example.php >&-")
0 commit comments