Skip to content

Commit ec2d719

Browse files
committed
Forward compatibility with react/promise 3
1 parent a80b842 commit ec2d719

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"require": {
2121
"php": ">=5.3",
2222
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.6",
23-
"react/promise": "^2.1 || ^1.2"
23+
"react/promise": "dev-master as 3.0.0 || ^2.1 || ^1.2"
2424
},
2525
"require-dev": {
2626
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",

src/UnwrapReadableStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function close()
126126
$this->closed = true;
127127

128128
// try to cancel promise once the stream closes
129-
if ($this->promise instanceof CancellablePromiseInterface) {
129+
if ($this->promise instanceof CancellablePromiseInterface || (method_exists($this->promise, 'cancel') && $this->promise instanceof PromiseInterface)) {
130130
$this->promise->cancel();
131131
}
132132
$this->promise = null;

src/UnwrapWritableStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function close()
153153
$this->closed = true;
154154

155155
// try to cancel promise once the stream closes
156-
if ($this->promise instanceof CancellablePromiseInterface) {
156+
if ($this->promise instanceof CancellablePromiseInterface || (method_exists($this->promise, 'cancel') && $this->promise instanceof PromiseInterface)) {
157157
$this->promise->cancel();
158158
}
159159
$this->promise = $this->stream = null;

0 commit comments

Comments
 (0)