Skip to content

Commit 85de9b5

Browse files
committed
Forward compatibility with Stream v0.5 semantics
1 parent fc76576 commit 85de9b5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"require": {
1414
"php": ">=5.3",
15-
"react/stream": "~0.4.3",
15+
"react/stream": "^0.5 || ^0.4.3",
1616
"clue/stream-filter": "~1.3"
1717
},
1818
"require-dev": {

src/TransformStream.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class TransformStream extends EventEmitter implements DuplexStreamInterface
2020
public function write($data)
2121
{
2222
if (!$this->writable || $data === '') {
23-
return;
23+
return false;
2424
}
2525

2626
try {
@@ -57,7 +57,7 @@ public function close()
5757
$this->readable = false;
5858
$this->writable = false;
5959

60-
$this->emit('close', array($this));
60+
$this->emit('close');
6161
}
6262

6363
public function isReadable()
@@ -98,10 +98,10 @@ public function pipe(WritableStreamInterface $dest, array $options = array())
9898
*/
9999
protected function forwardData($data)
100100
{
101-
if (!$this->readable && $data !== '') {
101+
if (!$this->readable) {
102102
return;
103103
}
104-
$this->emit('data', array($data, $this));
104+
$this->emit('data', array($data));
105105
}
106106

107107
/**
@@ -121,7 +121,7 @@ protected function forwardEnd()
121121
$this->readable = false;
122122
$this->writable = false;
123123

124-
$this->emit('end', array($this));
124+
$this->emit('end');
125125
$this->close();
126126
}
127127

@@ -143,7 +143,7 @@ protected function forwardError(Exception $error)
143143
$this->readable = false;
144144
$this->writable = false;
145145

146-
$this->emit('error', array($error, $this));
146+
$this->emit('error', array($error));
147147
$this->close();
148148
}
149149

0 commit comments

Comments
 (0)