@@ -93,8 +93,7 @@ discard block |
||
93 | 93 | $string = '(new ' . get_called_class(); |
94 | 94 | if (is_string($this->expectedTarget)) { |
95 | 95 | $string .= '(' . var_export($this->expectedTarget, true) . ')'; |
96 | - } |
|
97 | - elseif (is_object($this->expectedTarget)) { |
|
96 | + } elseif (is_object($this->expectedTarget)) { |
|
98 | 97 | $string .= '( ' . get_class($this->expectedTarget) . '#' . spl_object_id($this->expectedTarget) . ' )'; |
99 | 98 | } |
100 | 99 | $string .= ')'; |
@@ -107,8 +106,7 @@ discard block |
||
107 | 106 | return var_export($argument, true); |
108 | 107 | }, $call['arguments'])); |
109 | 108 | $string .= ')'; |
110 | - } |
|
111 | - else { |
|
109 | + } else { |
|
112 | 110 | $string .= '[' . var_export($call['entry'], true) . ']'; |
113 | 111 | } |
114 | 112 | } |
@@ -131,30 +129,25 @@ discard block |
||
131 | 129 | } |
132 | 130 | |
133 | 131 | $out = $this->expectedTarget; |
134 | - } |
|
135 | - elseif (is_string($this->expectedTarget)) { |
|
132 | + } elseif (is_string($this->expectedTarget)) { |
|
136 | 133 | if (class_exists($this->expectedTarget)) { |
137 | 134 | if (! $target instanceof $this->expectedTarget) { |
138 | 135 | throw new BadTargetClassException($this, $this->expectedTarget, $target); |
139 | 136 | } |
140 | - } |
|
141 | - elseif (interface_exists($this->expectedTarget)) { |
|
137 | + } elseif (interface_exists($this->expectedTarget)) { |
|
142 | 138 | if (! $target instanceof $this->expectedTarget) { |
143 | 139 | throw new BadTargetInterfaceException($this, $this->expectedTarget, $target); |
144 | 140 | } |
145 | - } |
|
146 | - elseif (type_exists($this->expectedTarget)) { |
|
141 | + } elseif (type_exists($this->expectedTarget)) { |
|
147 | 142 | if (gettype($target) != $this->expectedTarget) { |
148 | 143 | throw new BadTargetTypeException($this, $this->expectedTarget, $target); |
149 | 144 | } |
150 | - } |
|
151 | - else { |
|
145 | + } else { |
|
152 | 146 | throw new UndefinedTargetClassException($this, $this->expectedTarget); |
153 | 147 | } |
154 | 148 | |
155 | 149 | $out = $target; |
156 | - } |
|
157 | - else { |
|
150 | + } else { |
|
158 | 151 | $out = $target; |
159 | 152 | } |
160 | 153 | |
@@ -182,8 +175,7 @@ discard block |
||
182 | 175 | [$current_chained_subject, $method_name], |
183 | 176 | $arguments |
184 | 177 | ); |
185 | - } |
|
186 | - catch (\BadMethodCallException $e) { |
|
178 | + } catch (\BadMethodCallException $e) { |
|
187 | 179 | if ( |
188 | 180 | ( |
189 | 181 | ( PHP_VERSION_ID < 70000 |
@@ -203,8 +195,7 @@ discard block |
||
203 | 195 | && $e->getTrace()[0]['class'] == get_class($current_chained_subject) |
204 | 196 | ) { |
205 | 197 | $is_called = false; |
206 | - } |
|
207 | - else { |
|
198 | + } else { |
|
208 | 199 | throw $e; |
209 | 200 | } |
210 | 201 | } |
@@ -246,12 +237,10 @@ discard block |
||
246 | 237 | . " nor a function" |
247 | 238 | ); |
248 | 239 | } |
249 | - } |
|
250 | - else { |
|
240 | + } else { |
|
251 | 241 | $out = $out[ $call['entry'] ]; |
252 | 242 | } |
253 | - } |
|
254 | - catch (\Exception $e) { |
|
243 | + } catch (\Exception $e) { |
|
255 | 244 | // Throw $e with the good stack (usage exception) |
256 | 245 | throw $e; |
257 | 246 | } |