File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Expand file tree Collapse file tree 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)
139139 */
140140 private static function makeCallable ($ result )
141141 {
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 ) {
144148 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+ };
157150 }
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 ' );
158159 }
159160
160161 /**
You can’t perform that action at this time.
0 commit comments