Skip to content

Commit a39db4f

Browse files
authored
Minor code style improvements to fix phpstan analysis warnings (#140)
Minor code style improvements to fix phpstan analysis warnings
2 parents 5042685 + 07140ba commit a39db4f

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

src/CompositeStream.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public function __construct(ReadableStreamInterface $readable, WritableStreamInt
1616
$this->writable = $writable;
1717

1818
if (!$readable->isReadable() || !$writable->isWritable()) {
19-
return $this->close();
19+
$this->close();
20+
return;
2021
}
2122

2223
Util::forwardEvents($this->readable, $this, array('data', 'end', 'error'));

src/DuplexResourceStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct($stream, LoopInterface $loop, $readChunkSize = null,
4949

5050
// this class relies on non-blocking I/O in order to not interrupt the event loop
5151
// e.g. pipes on Windows do not support this: https://bugs.php.net/bug.php?id=47918
52-
if (\stream_set_blocking($stream, 0) !== true) {
52+
if (\stream_set_blocking($stream, false) !== true) {
5353
throw new \RuntimeException('Unable to set stream resource to non-blocking mode');
5454
}
5555

src/ReadableResourceStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct($stream, LoopInterface $loop, $readChunkSize = null)
5252

5353
// this class relies on non-blocking I/O in order to not interrupt the event loop
5454
// e.g. pipes on Windows do not support this: https://bugs.php.net/bug.php?id=47918
55-
if (\stream_set_blocking($stream, 0) !== true) {
55+
if (\stream_set_blocking($stream, false) !== true) {
5656
throw new \RuntimeException('Unable to set stream resource to non-blocking mode');
5757
}
5858

src/WritableResourceStream.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ final class WritableResourceStream extends EventEmitter implements WritableStrea
99
{
1010
private $stream;
1111
private $loop;
12+
13+
/**
14+
* @var int
15+
*/
1216
private $softLimit;
17+
18+
/**
19+
* @var int
20+
*/
1321
private $writeChunkSize;
1422

1523
private $listening = false;
@@ -31,7 +39,7 @@ public function __construct($stream, LoopInterface $loop, $writeBufferSoftLimit
3139

3240
// this class relies on non-blocking I/O in order to not interrupt the event loop
3341
// e.g. pipes on Windows do not support this: https://bugs.php.net/bug.php?id=47918
34-
if (\stream_set_blocking($stream, 0) !== true) {
42+
if (\stream_set_blocking($stream, false) !== true) {
3543
throw new \RuntimeException('Unable to set stream resource to non-blocking mode');
3644
}
3745

0 commit comments

Comments
 (0)