@@ -53,13 +53,13 @@ public function __construct(PromiseInterface $promise, RequestInterface $request
5353 $ this ->state = self ::FULFILLED ;
5454
5555 return $ response ;
56- }, function ($ reason ) use ( $ request ) {
56+ }, function ($ reason ) {
5757 $ this ->state = self ::REJECTED ;
5858
5959 if ($ reason instanceof HttplugException) {
6060 $ this ->exception = $ reason ;
6161 } elseif ($ reason instanceof GuzzleExceptions \GuzzleException) {
62- $ this ->exception = $ this ->handleException ($ reason, $ request );
62+ $ this ->exception = $ this ->handleException ($ reason );
6363 } elseif ($ reason instanceof \Throwable) {
6464 $ this ->exception = new HttplugException \TransferException ('Invalid exception returned from Guzzle7 ' , 0 , $ reason );
6565 } else {
@@ -70,31 +70,22 @@ public function __construct(PromiseInterface $promise, RequestInterface $request
7070 });
7171 }
7272
73- /**
74- * {@inheritdoc}
75- */
76- public function then (callable $ onFulfilled = null , callable $ onRejected = null )
73+ public function then (?callable $ onFulfilled = null , ?callable $ onRejected = null )
7774 {
7875 return new static ($ this ->promise ->then ($ onFulfilled , $ onRejected ), $ this ->request );
7976 }
8077
81- /**
82- * {@inheritdoc}
83- */
8478 public function getState ()
8579 {
8680 return $ this ->state ;
8781 }
8882
89- /**
90- * {@inheritdoc}
91- */
9283 public function wait ($ unwrap = true )
9384 {
9485 $ this ->promise ->wait (false );
9586
9687 if ($ unwrap ) {
97- if (self ::REJECTED == $ this ->getState ()) {
88+ if (self ::REJECTED === $ this ->getState ()) {
9889 throw $ this ->exception ;
9990 }
10091
@@ -107,7 +98,7 @@ public function wait($unwrap = true)
10798 *
10899 * @return HttplugException
109100 */
110- private function handleException (GuzzleExceptions \GuzzleException $ exception, RequestInterface $ request )
101+ private function handleException (GuzzleExceptions \GuzzleException $ exception )
111102 {
112103 if ($ exception instanceof GuzzleExceptions \ConnectException) {
113104 return new HttplugException \NetworkException ($ exception ->getMessage (), $ exception ->getRequest (), $ exception );
0 commit comments