@@ -53,13 +53,13 @@ public function __construct(PromiseInterface $promise, RequestInterface $request
53
53
$ this ->state = self ::FULFILLED ;
54
54
55
55
return $ response ;
56
- }, function ($ reason ) use ( $ request ) {
56
+ }, function ($ reason ) {
57
57
$ this ->state = self ::REJECTED ;
58
58
59
59
if ($ reason instanceof HttplugException) {
60
60
$ this ->exception = $ reason ;
61
61
} elseif ($ reason instanceof GuzzleExceptions \GuzzleException) {
62
- $ this ->exception = $ this ->handleException ($ reason, $ request );
62
+ $ this ->exception = $ this ->handleException ($ reason );
63
63
} elseif ($ reason instanceof \Throwable) {
64
64
$ this ->exception = new HttplugException \TransferException ('Invalid exception returned from Guzzle7 ' , 0 , $ reason );
65
65
} else {
@@ -70,31 +70,22 @@ public function __construct(PromiseInterface $promise, RequestInterface $request
70
70
});
71
71
}
72
72
73
- /**
74
- * {@inheritdoc}
75
- */
76
- public function then (callable $ onFulfilled = null , callable $ onRejected = null )
73
+ public function then (?callable $ onFulfilled = null , ?callable $ onRejected = null )
77
74
{
78
75
return new static ($ this ->promise ->then ($ onFulfilled , $ onRejected ), $ this ->request );
79
76
}
80
77
81
- /**
82
- * {@inheritdoc}
83
- */
84
78
public function getState ()
85
79
{
86
80
return $ this ->state ;
87
81
}
88
82
89
- /**
90
- * {@inheritdoc}
91
- */
92
83
public function wait ($ unwrap = true )
93
84
{
94
85
$ this ->promise ->wait (false );
95
86
96
87
if ($ unwrap ) {
97
- if (self ::REJECTED == $ this ->getState ()) {
88
+ if (self ::REJECTED === $ this ->getState ()) {
98
89
throw $ this ->exception ;
99
90
}
100
91
@@ -107,7 +98,7 @@ public function wait($unwrap = true)
107
98
*
108
99
* @return HttplugException
109
100
*/
110
- private function handleException (GuzzleExceptions \GuzzleException $ exception, RequestInterface $ request )
101
+ private function handleException (GuzzleExceptions \GuzzleException $ exception )
111
102
{
112
103
if ($ exception instanceof GuzzleExceptions \ConnectException) {
113
104
return new HttplugException \NetworkException ($ exception ->getMessage (), $ exception ->getRequest (), $ exception );
0 commit comments