Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
11 changes: 5 additions & 6 deletions examples/validate.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

use React\EventLoop\Factory;
use React\Stream\Stream;
use React\Stream\ReadableResourceStream;
use React\Stream\WritableResourceStream;
use Clue\React\NDJson\Decoder;
use Clue\React\NDJson\Encoder;

Expand All @@ -10,11 +11,9 @@
$loop = Factory::create();

$exit = 0;
$in = new Stream(STDIN, $loop);
$out = new Stream(STDOUT, $loop);
$out->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);
Expand Down
7 changes: 5 additions & 2 deletions tests/DecoderTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use React\Stream\ReadableStream;
use React\Stream\ReadableResourceStream;
use Clue\React\NDJson\Decoder;

class DecoderTest extends TestCase
Expand All @@ -10,7 +10,10 @@ class DecoderTest extends TestCase

public function setUp()
{
$this->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);
}

Expand Down
7 changes: 5 additions & 2 deletions tests/EncoderTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use React\Stream\WritableStream;
use React\Stream\WritableResourceStream;
use Clue\React\NDJson\Encoder;

class EncoderTest extends TestCase
Expand All @@ -10,7 +10,10 @@ class EncoderTest extends TestCase

public function setUp()
{
$this->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);
}

Expand Down