File tree 1 file changed +15
-14
lines changed
1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -139,22 +139,23 @@ public function on(RequestMatcher $requestMatcher, $result)
139
139
*/
140
140
private static function makeCallable ($ result )
141
141
{
142
- switch (true ) {
143
- case is_callable ($ result ):
142
+ if (is_callable ($ result )) {
143
+ return $ result ;
144
+ }
145
+
146
+ if ($ result instanceof ResponseInterface) {
147
+ return function () use ($ result ) {
144
148
return $ result ;
145
- case $ result instanceof ResponseInterface:
146
- return function () use ($ result ) {
147
- return $ result ;
148
- };
149
-
150
- break ;
151
- case $ result instanceof \Exception:
152
- return function () use ($ result ) {
153
- throw $ result ;
154
- };
155
- default :
156
- throw new \InvalidArgumentException ('Result must be either a response, an exception, or a callable ' );
149
+ };
157
150
}
151
+
152
+ if ($ result instanceof \Exception) {
153
+ return function () use ($ result ) {
154
+ throw $ result ;
155
+ };
156
+ }
157
+
158
+ throw new \InvalidArgumentException ('Result must be either a response, an exception, or a callable ' );
158
159
}
159
160
160
161
/**
You can’t perform that action at this time.
0 commit comments