From 51072c0232ba53b13a6a78e3439ac2f272a1465d Mon Sep 17 00:00:00 2001 From: Katie Volz Date: Fri, 7 Jan 2022 22:22:18 -0500 Subject: [PATCH 1/2] Return Future::error rather than abandoning --- src/AsyncWriter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AsyncWriter.php b/src/AsyncWriter.php index c48a17f..7ad9e5c 100644 --- a/src/AsyncWriter.php +++ b/src/AsyncWriter.php @@ -84,7 +84,7 @@ public function __destruct() public function write(string $bytes): Future { if (!$this->isWritable()) { - Future::error(new ClosedException('The destination stream is no longer writable')); + return Future::error(new ClosedException('The destination stream is no longer writable')); } $deferredFuture = new DeferredFuture(); @@ -103,7 +103,7 @@ public function write(string $bytes): Future public function end(): Future { if (!$this->isWritable()) { - Future::error(new ClosedException('The destination stream is no longer writable')); + return Future::error(new ClosedException('The destination stream is no longer writable')); } $this->destination = null; From 25427f4afdc5b564cec98c766c4ff186688cd577 Mon Sep 17 00:00:00 2001 From: Katie Volz Date: Sat, 8 Jan 2022 10:07:26 -0500 Subject: [PATCH 2/2] Change return type of AsyncWriter::write --- src/AsyncWriter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AsyncWriter.php b/src/AsyncWriter.php index 7ad9e5c..295c538 100644 --- a/src/AsyncWriter.php +++ b/src/AsyncWriter.php @@ -79,7 +79,7 @@ public function __destruct() * * @param string $bytes * - * @return Future + * @return Future */ public function write(string $bytes): Future {