Skip to content

Commit

Permalink
Forward compatibility with react/promise 3
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Jan 31, 2020
1 parent a80b842 commit ec2d719
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/UnwrapReadableStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/UnwrapWritableStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ec2d719

Please sign in to comment.