diff --git a/src/CompositeStream.php b/src/CompositeStream.php index 153f2a3..dde091d 100644 --- a/src/CompositeStream.php +++ b/src/CompositeStream.php @@ -16,7 +16,8 @@ public function __construct(ReadableStreamInterface $readable, WritableStreamInt $this->writable = $writable; if (!$readable->isReadable() || !$writable->isWritable()) { - return $this->close(); + $this->close(); + return; } Util::forwardEvents($this->readable, $this, array('data', 'end', 'error')); diff --git a/src/DuplexResourceStream.php b/src/DuplexResourceStream.php index 5f038c6..c8c1c50 100644 --- a/src/DuplexResourceStream.php +++ b/src/DuplexResourceStream.php @@ -49,7 +49,7 @@ public function __construct($stream, LoopInterface $loop, $readChunkSize = null, // this class relies on non-blocking I/O in order to not interrupt the event loop // e.g. pipes on Windows do not support this: https://bugs.php.net/bug.php?id=47918 - if (\stream_set_blocking($stream, 0) !== true) { + if (\stream_set_blocking($stream, false) !== true) { throw new \RuntimeException('Unable to set stream resource to non-blocking mode'); } diff --git a/src/ReadableResourceStream.php b/src/ReadableResourceStream.php index 461f6e4..9d9c006 100644 --- a/src/ReadableResourceStream.php +++ b/src/ReadableResourceStream.php @@ -52,7 +52,7 @@ public function __construct($stream, LoopInterface $loop, $readChunkSize = null) // this class relies on non-blocking I/O in order to not interrupt the event loop // e.g. pipes on Windows do not support this: https://bugs.php.net/bug.php?id=47918 - if (\stream_set_blocking($stream, 0) !== true) { + if (\stream_set_blocking($stream, false) !== true) { throw new \RuntimeException('Unable to set stream resource to non-blocking mode'); } diff --git a/src/WritableResourceStream.php b/src/WritableResourceStream.php index 57c09b2..ff726cc 100644 --- a/src/WritableResourceStream.php +++ b/src/WritableResourceStream.php @@ -9,7 +9,15 @@ final class WritableResourceStream extends EventEmitter implements WritableStrea { private $stream; private $loop; + + /** + * @var int + */ private $softLimit; + + /** + * @var int + */ private $writeChunkSize; private $listening = false; @@ -31,7 +39,7 @@ public function __construct($stream, LoopInterface $loop, $writeBufferSoftLimit // this class relies on non-blocking I/O in order to not interrupt the event loop // e.g. pipes on Windows do not support this: https://bugs.php.net/bug.php?id=47918 - if (\stream_set_blocking($stream, 0) !== true) { + if (\stream_set_blocking($stream, false) !== true) { throw new \RuntimeException('Unable to set stream resource to non-blocking mode'); }