File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/Illuminate/Http/Client Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -305,14 +305,13 @@ public function toException()
305
305
/**
306
306
* Throw an exception if a server or client error occurred.
307
307
*
308
+ * @param null|(\Closure(\Illuminate\Http\Client\Response, \Illuminate\Http\Client\RequestException): mixed) $callback
308
309
* @return $this
309
310
*
310
311
* @throws \Illuminate\Http\Client\RequestException
311
312
*/
312
- public function throw ()
313
+ public function throw ($ callback = null )
313
314
{
314
- $ callback = func_get_args ()[0 ] ?? null ;
315
-
316
315
if ($ this ->failed ()) {
317
316
throw tap ($ this ->toException (), function ($ exception ) use ($ callback ) {
318
317
if ($ callback && is_callable ($ callback )) {
@@ -328,13 +327,14 @@ public function throw()
328
327
* Throw an exception if a server or client error occurred and the given condition evaluates to true.
329
328
*
330
329
* @param \Closure|bool $condition
330
+ * @param null|(\Closure(\Illuminate\Http\Client\Response, \Illuminate\Http\Client\RequestException): mixed) $callback
331
331
* @return $this
332
332
*
333
333
* @throws \Illuminate\Http\Client\RequestException
334
334
*/
335
- public function throwIf ($ condition )
335
+ public function throwIf ($ condition, $ callback = null )
336
336
{
337
- return value ($ condition , $ this ) ? $ this ->throw (func_get_args ()[ 1 ] ?? null ) : $ this ;
337
+ return value ($ condition , $ this ) ? $ this ->throw ($ callback ) : $ this ;
338
338
}
339
339
340
340
/**
You can’t perform that action at this time.
0 commit comments