From 0f0a271bc9b7d02a053d36fcdcb12662e2a8096e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 7 Jun 2020 21:21:28 +0200 Subject: [PATCH] allow cursor to be used even when STDIN is not defined --- Cursor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cursor.php b/Cursor.php index 9f8be9649..2da899b55 100644 --- a/Cursor.php +++ b/Cursor.php @@ -21,10 +21,10 @@ final class Cursor private $output; private $input; - public function __construct(OutputInterface $output, $input = STDIN) + public function __construct(OutputInterface $output, $input = null) { $this->output = $output; - $this->input = $input; + $this->input = $input ?? (\defined('STDIN') ? STDIN : fopen('php://input', 'r+')); } public function moveUp(int $lines = 1): self