diff --git a/composer.json b/composer.json index ee3972c..f220f40 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,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": "^3 || ^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..b1725f5 100644 --- a/src/UnwrapReadableStream.php +++ b/src/UnwrapReadableStream.php @@ -4,7 +4,6 @@ use Evenement\EventEmitter; use InvalidArgumentException; -use React\Promise\CancellablePromiseInterface; use React\Promise\PromiseInterface; use React\Stream\ReadableStreamInterface; use React\Stream\Util; @@ -126,7 +125,7 @@ public function close() $this->closed = true; // try to cancel promise once the stream closes - if ($this->promise instanceof CancellablePromiseInterface) { + if ($this->promise !== null && \method_exists($this->promise, 'cancel')) { $this->promise->cancel(); } $this->promise = null; diff --git a/src/UnwrapWritableStream.php b/src/UnwrapWritableStream.php index f19e706..85730e9 100644 --- a/src/UnwrapWritableStream.php +++ b/src/UnwrapWritableStream.php @@ -4,7 +4,6 @@ use Evenement\EventEmitter; use InvalidArgumentException; -use React\Promise\CancellablePromiseInterface; use React\Promise\PromiseInterface; use React\Stream\WritableStreamInterface; @@ -153,7 +152,7 @@ public function close() $this->closed = true; // try to cancel promise once the stream closes - if ($this->promise instanceof CancellablePromiseInterface) { + if ($this->promise !== null && \method_exists($this->promise, 'cancel')) { $this->promise->cancel(); } $this->promise = $this->stream = null;