Skip to content

Commit 54c7325

Browse files
authored
add missing params (#54798)
1 parent 251f55e commit 54c7325

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Illuminate/Http/Client/Response.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,13 @@ public function toException()
305305
/**
306306
* Throw an exception if a server or client error occurred.
307307
*
308+
* @param null|(\Closure(\Illuminate\Http\Client\Response, \Illuminate\Http\Client\RequestException): mixed) $callback
308309
* @return $this
309310
*
310311
* @throws \Illuminate\Http\Client\RequestException
311312
*/
312-
public function throw()
313+
public function throw($callback = null)
313314
{
314-
$callback = func_get_args()[0] ?? null;
315-
316315
if ($this->failed()) {
317316
throw tap($this->toException(), function ($exception) use ($callback) {
318317
if ($callback && is_callable($callback)) {
@@ -328,13 +327,14 @@ public function throw()
328327
* Throw an exception if a server or client error occurred and the given condition evaluates to true.
329328
*
330329
* @param \Closure|bool $condition
330+
* @param null|(\Closure(\Illuminate\Http\Client\Response, \Illuminate\Http\Client\RequestException): mixed) $callback
331331
* @return $this
332332
*
333333
* @throws \Illuminate\Http\Client\RequestException
334334
*/
335-
public function throwIf($condition)
335+
public function throwIf($condition, $callback = null)
336336
{
337-
return value($condition, $this) ? $this->throw(func_get_args()[1] ?? null) : $this;
337+
return value($condition, $this) ? $this->throw($callback) : $this;
338338
}
339339

340340
/**

0 commit comments

Comments
 (0)