File tree 4 files changed +13
-5
lines changed
test/Rx/Functional/Promise
4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 21
21
],
22
22
"require" : {
23
23
"php" : " >=7.0.0" ,
24
- "react/promise" : " ~2.2"
24
+ "react/promise" : " ^3 || ~2.2"
25
25
},
26
26
"require-dev" : {
27
27
"satooshi/php-coveralls" : " ~1.0" ,
Original file line number Diff line number Diff line change
1
+ parameters:
2
+ level: max
3
+
4
+ paths:
5
+ - test/types/
6
+
7
+ fileExtensions:
8
+ - php
Original file line number Diff line number Diff line change 2
2
3
3
namespace Rx \React ;
4
4
5
- use React \Promise \CancellablePromiseInterface ;
6
5
use React \Promise \Promise as ReactPromise ;
7
6
use React \Promise \PromiseInterface ;
8
7
use Rx \Disposable \CallbackDisposable ;
11
10
use Rx \Observable \AnonymousObservable ;
12
11
use Rx \Subject \AsyncSubject ;
13
12
use React \Promise \Deferred ;
13
+ use Throwable ;
14
14
15
15
final class Promise
16
16
{
@@ -32,7 +32,7 @@ public static function resolved($value): ReactPromise
32
32
public static function rejected ($ exception ): ReactPromise
33
33
{
34
34
$ d = new Deferred ();
35
- $ d ->reject ($ exception );
35
+ $ d ->reject ($ exception instanceof Throwable ? $ exception : new RejectedPromiseException ( $ exception ) );
36
36
return $ d ->promise ();
37
37
}
38
38
@@ -94,7 +94,7 @@ function ($error) use ($subject) {
94
94
$ disp = $ subject ->subscribe ($ observer );
95
95
return new CallbackDisposable (function () use ($ p , $ disp ) {
96
96
$ disp ->dispose ();
97
- if ($ p instanceof CancellablePromiseInterface ) {
97
+ if (\method_exists ( $ p , ' cancel ' ) ) {
98
98
$ p ->cancel ();
99
99
}
100
100
});
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ function () {
40
40
*/
41
41
public function from_promise_failure ()
42
42
{
43
- $ p = \React \Promise \reject ('error ' );
43
+ $ p = \React \Promise \reject (new RejectedPromiseException ( 'error ' ) );
44
44
45
45
$ source = Observable::fromPromise ($ p );
46
46
You can’t perform that action at this time.
0 commit comments