Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
],
"require": {
"php": ">=7.0.0",
"react/promise": "~2.2"
"react/promise": "^3 || ~2.2"
},
"require-dev": {
"satooshi/php-coveralls": "~1.0",
Expand Down
8 changes: 8 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
parameters:
level: max

paths:
- test/types/

fileExtensions:
- php
6 changes: 3 additions & 3 deletions src/React/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Rx\React;

use React\Promise\CancellablePromiseInterface;
use React\Promise\Promise as ReactPromise;
use React\Promise\PromiseInterface;
use Rx\Disposable\CallbackDisposable;
Expand All @@ -11,6 +10,7 @@
use Rx\Observable\AnonymousObservable;
use Rx\Subject\AsyncSubject;
use React\Promise\Deferred;
use Throwable;

final class Promise
{
Expand All @@ -32,7 +32,7 @@ public static function resolved($value): ReactPromise
public static function rejected($exception): ReactPromise
{
$d = new Deferred();
$d->reject($exception);
$d->reject($exception instanceof Throwable ? $exception : new RejectedPromiseException($exception));
return $d->promise();
}

Expand Down Expand Up @@ -94,7 +94,7 @@ function ($error) use ($subject) {
$disp = $subject->subscribe($observer);
return new CallbackDisposable(function () use ($p, $disp) {
$disp->dispose();
if ($p instanceof CancellablePromiseInterface) {
if (\method_exists($p, 'cancel')) {
$p->cancel();
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/Rx/Functional/Promise/FromPromiseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function () {
*/
public function from_promise_failure()
{
$p = \React\Promise\reject('error');
$p = \React\Promise\reject(new RejectedPromiseException('error'));

$source = Observable::fromPromise($p);

Expand Down