@@ -22,7 +22,20 @@ class Stdio extends EventEmitter implements DuplexStreamInterface
2222 private $ incompleteLine = '' ;
2323 private $ originalTtyMode = null ;
2424
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 )
2639 {
2740 if ($ input === null ) {
2841 $ input = $ this ->createStdin ($ loop ); // @codeCoverageIgnore
@@ -529,11 +542,11 @@ private function restoreTtyMode()
529542 }
530543
531544 /**
532- * @param LoopInterface $loop
545+ * @param ? LoopInterface $loop
533546 * @return ReadableStreamInterface
534547 * @codeCoverageIgnore this is covered by functional tests with/without ext-readline
535548 */
536- private function createStdin (LoopInterface $ loop )
549+ private function createStdin (LoopInterface $ loop = null )
537550 {
538551 // STDIN not defined ("php -a") or already closed (`fclose(STDIN)`)
539552 // also support starting program with closed STDIN ("example.php 0<&-")
@@ -569,11 +582,11 @@ private function createStdin(LoopInterface $loop)
569582 }
570583
571584 /**
572- * @param LoopInterface $loop
585+ * @param ? LoopInterface $loop
573586 * @return WritableStreamInterface
574587 * @codeCoverageIgnore this is covered by functional tests
575588 */
576- private function createStdout (LoopInterface $ loop )
589+ private function createStdout (LoopInterface $ loop = null )
577590 {
578591 // STDOUT not defined ("php -a") or already closed (`fclose(STDOUT)`)
579592 // also support starting program with closed STDOUT ("example.php >&-")
0 commit comments