Skip to content

Commit 987c5a0

Browse files
committed
Enhancement: Return early
1 parent 2875fd7 commit 987c5a0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/Client.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -141,26 +141,20 @@ private static function makeCallable($result)
141141
{
142142
switch (true) {
143143
case is_callable($result):
144-
$callable = $result;
145-
146-
break;
144+
return $result;
147145
case $result instanceof ResponseInterface:
148-
$callable = function () use ($result) {
146+
return function () use ($result) {
149147
return $result;
150148
};
151149

152150
break;
153151
case $result instanceof \Exception:
154-
$callable = function () use ($result) {
152+
return function () use ($result) {
155153
throw $result;
156154
};
157-
158-
break;
159155
default:
160156
throw new \InvalidArgumentException('Result must be either a response, an exception, or a callable');
161157
}
162-
163-
return $callable;
164158
}
165159

166160
/**

0 commit comments

Comments
 (0)