diff --git a/README.md b/README.md index effba9e..640731e 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ as parsed values instead of just chunks of strings: "hello w\u00f6rld"\r\n ``` ```php -$stdin = new Stream(STDIN, $loop); +$stdin = new ReadableResourceStream(STDIN, $loop); $stream = new Decoder($stdin); @@ -118,7 +118,7 @@ and accepts its data through the same interface, but handles any data as complet JSON elements instead of just chunks of strings: ```php -$stdout = new Stream(STDOUT, $loop); +$stdout = new WritableResourceStream(STDOUT, $loop); $stream = new Encoder($stdout); diff --git a/composer.json b/composer.json index f0eb6de..c38c393 100644 --- a/composer.json +++ b/composer.json @@ -15,10 +15,11 @@ }, "require": { "php": ">=5.3", - "react/stream": "^0.4 || ^0.3" + "react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4 || ^0.3" }, "require-dev": { "react/event-loop": " ^0.4 || ^0.3", - "phpunit/phpunit": "^5.0 || ^4.8" + "phpunit/phpunit": "^5.0 || ^4.8", + "react/stream": "^1.0 || ^0.7 || ^0.6" } } diff --git a/examples/validate.php b/examples/validate.php index 6307e0e..ea4f5d9 100644 --- a/examples/validate.php +++ b/examples/validate.php @@ -1,7 +1,8 @@ pause(); -$info = new Stream(STDERR, $loop); -$info->pause(); +$in = new ReadableResourceStream(STDIN, $loop); +$out = new WritableResourceStream(STDOUT, $loop); +$info = new WritableResourceStream(STDERR, $loop); $decoder = new Decoder($in); $encoder = new Encoder($out); diff --git a/tests/DecoderTest.php b/tests/DecoderTest.php index b62d933..c863d76 100644 --- a/tests/DecoderTest.php +++ b/tests/DecoderTest.php @@ -1,6 +1,6 @@ input = new ReadableStream(); + $stream = fopen('php://temp', 'r'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); + + $this->input = new ReadableResourceStream($stream, $loop); $this->decoder = new Decoder($this->input); } diff --git a/tests/EncoderTest.php b/tests/EncoderTest.php index be1949b..a212b86 100644 --- a/tests/EncoderTest.php +++ b/tests/EncoderTest.php @@ -1,6 +1,6 @@ output = new WritableStream(); + $stream = fopen('php://temp', 'r+'); + $loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock(); + + $this->output = new WritableResourceStream($stream, $loop); $this->encoder = new Encoder($this->output); }