Skip to content

Commit

Permalink
Minor code style improvements to fix phpstan analysis warnings (#140)
Browse files Browse the repository at this point in the history
Minor code style improvements to fix phpstan analysis warnings
  • Loading branch information
WyriHaximus authored May 23, 2019
2 parents 5042685 + 07140ba commit a39db4f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/CompositeStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
2 changes: 1 addition & 1 deletion src/DuplexResourceStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
2 changes: 1 addition & 1 deletion src/ReadableResourceStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
10 changes: 9 additions & 1 deletion src/WritableResourceStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
}

Expand Down

0 comments on commit a39db4f

Please sign in to comment.