Skip to content

Commit 6efad75

Browse files
committed
Forward compatibility with Stream v1.0 and v0.7
1 parent e3eea5f commit 6efad75

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"php": ">=5.3.0",
88
"react/cache": "~0.4.0|~0.3.0",
99
"react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5 || ^0.4.4",
10-
"react/stream": "^0.6 || ^0.5 || ^0.4.5",
10+
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.5",
1111
"react/promise": "~2.1|~1.2",
1212
"react/promise-timer": "~1.1"
1313
},

src/Config/FilesystemFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use React\Promise;
77
use React\Promise\Deferred;
88
use React\Stream\Stream;
9+
use React\Stream\ReadableResourceStream;
910

1011
class FilesystemFactory
1112
{
@@ -55,7 +56,7 @@ public function loadEtcResolvConf($filename)
5556

5657
$contents = '';
5758

58-
$stream = new Stream($fd, $this->loop);
59+
$stream = class_exists('React\Stream\ReadableResourceStream') ? new ReadableResourceStream($fd, $this->loop) : new Stream($fd, $this->loop);
5960
$stream->on('data', function ($data) use (&$contents) {
6061
$contents .= $data;
6162
});

0 commit comments

Comments
 (0)