diff --git a/composer.json b/composer.json index 7fe0bc3..68cef83 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "require": { "php": ">=5.3", "react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.6", - "react/promise": "^2.1 || ^1.2" + "react/promise": "dev-master as 3.0.0 || ^2.1 || ^1.2" }, "require-dev": { "react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3", diff --git a/src/UnwrapReadableStream.php b/src/UnwrapReadableStream.php index acd23be..cafa040 100644 --- a/src/UnwrapReadableStream.php +++ b/src/UnwrapReadableStream.php @@ -126,7 +126,7 @@ public function close() $this->closed = true; // try to cancel promise once the stream closes - if ($this->promise instanceof CancellablePromiseInterface) { + if ($this->promise instanceof CancellablePromiseInterface || (method_exists($this->promise, 'cancel') && $this->promise instanceof PromiseInterface)) { $this->promise->cancel(); } $this->promise = null; diff --git a/src/UnwrapWritableStream.php b/src/UnwrapWritableStream.php index f19e706..636382b 100644 --- a/src/UnwrapWritableStream.php +++ b/src/UnwrapWritableStream.php @@ -153,7 +153,7 @@ public function close() $this->closed = true; // try to cancel promise once the stream closes - if ($this->promise instanceof CancellablePromiseInterface) { + if ($this->promise instanceof CancellablePromiseInterface || (method_exists($this->promise, 'cancel') && $this->promise instanceof PromiseInterface)) { $this->promise->cancel(); } $this->promise = $this->stream = null;