@@ -71,11 +71,11 @@ public function then(callable $onFulfilled = null, callable $onRejected = null)
71
71
{
72
72
$ newPromise = new self ($ this ->loop );
73
73
74
- $ onFulfilled = $ onFulfilled !== null ? $ onFulfilled : function (ResponseInterface $ response ) {
74
+ $ onFulfilled = null !== $ onFulfilled ? $ onFulfilled : function (ResponseInterface $ response ) {
75
75
return $ response ;
76
76
};
77
77
78
- $ onRejected = $ onRejected !== null ? $ onRejected : function (Exception $ exception ) {
78
+ $ onRejected = null !== $ onRejected ? $ onRejected : function (Exception $ exception ) {
79
79
throw $ exception ;
80
80
};
81
81
@@ -95,11 +95,11 @@ public function then(callable $onFulfilled = null, callable $onRejected = null)
95
95
}
96
96
};
97
97
98
- if ($ this -> state === HttpPromise:: FULFILLED ) {
98
+ if (HttpPromise:: FULFILLED === $ this -> state ) {
99
99
$ this ->doResolve ($ this ->response );
100
100
}
101
101
102
- if ($ this -> state === HttpPromise:: REJECTED ) {
102
+ if (HttpPromise:: REJECTED === $ this -> state ) {
103
103
$ this ->doReject ($ this ->exception );
104
104
}
105
105
@@ -115,7 +115,7 @@ public function then(callable $onFulfilled = null, callable $onRejected = null)
115
115
*/
116
116
public function resolve (ResponseInterface $ response )
117
117
{
118
- if ($ this -> state !== HttpPromise:: PENDING ) {
118
+ if (HttpPromise:: PENDING !== $ this -> state ) {
119
119
throw new \RuntimeException ('Promise is already resolved ' );
120
120
}
121
121
@@ -142,7 +142,7 @@ private function doResolve(ResponseInterface $response)
142
142
*/
143
143
public function reject (Exception $ exception )
144
144
{
145
- if ($ this -> state !== HttpPromise:: PENDING ) {
145
+ if (HttpPromise:: PENDING !== $ this -> state ) {
146
146
throw new \RuntimeException ('Promise is already resolved ' );
147
147
}
148
148
0 commit comments