Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Code Review comments
  • Loading branch information
WendellAdriel committed Sep 25, 2025
commit c432c1f2f29bedb7beeb27a5cfa883242c9554ce
52 changes: 26 additions & 26 deletions src/Illuminate/Http/Client/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ class Batch
/**
* The total number of requests that belong to the batch.
*
* @var int
* @var non-negative-int
*/
public $totalRequests = 0;

/**
* The total number of requests that are still pending.
*
* @var int
* @var non-negative-int
*/
public $pendingRequests = 0;

/**
* The total number of requests that have failed.
*
* @var int
* @var non-negative-int
*/
public $failedRequests = 0;

Expand All @@ -58,31 +58,38 @@ class Batch
/**
* The callback to run before the first request from the batch runs.
*
* @var \Closure|null
* @var (\Closure($this): void)|null
*/
protected $beforeCallback = null;

/**
* The callback to run after a request from the batch succeeds.
*
* @var \Closure|null
* @var (\Closure($this, int|string, \Illuminate\Http\Response): void)|null
*/
protected $progressCallback = null;

/**
* The callback to run after a request from the batch fails.
*
* @var \Closure|null
* @var (\Closure($this, int|string, \Illuminate\Http\Response|\Illuminate\Http\Client\RequestException): void)|null
*/
protected $catchCallback = null;

/**
* The callback to run if all the requests from the batch succeeded.
*
* @var \Closure|null
* @var (\Closure($this, array<int|string, \Illuminate\Http\Response>): void)|null
*/
protected $thenCallback = null;

/**
* The callback to run after all the requests from the batch finish.
*
* @var (\Closure($this, array<int|string, \Illuminate\Http\Response>): void)|null
*/
protected $finallyCallback = null;

/**
* If the batch already was sent.
*
Expand All @@ -104,13 +111,6 @@ class Batch
*/
public $finishedAt = null;

/**
* The callback to run after all the requests from the batch finish.
*
* @var \Closure|null
*/
protected $finallyCallback = null;

/**
* Create a new request batch instance.
*
Expand Down Expand Up @@ -145,7 +145,7 @@ public function as(string $key)
/**
* Get the total number of requests that have been processed by the batch thus far.
*
* @return int
* @return non-negative-int
*/
public function processedRequests(): int
{
Expand All @@ -155,7 +155,7 @@ public function processedRequests(): int
/**
* Get the percentage of requests that have been processed (between 0-100).
*
* @return int
* @return non-negative-int
*/
public function completion(): int
{
Expand Down Expand Up @@ -185,7 +185,7 @@ public function finished(): bool
/**
* Register a callback to run before the first request from the batch runs.
*
* @param \Closure $callback
* @param (\Closure($this): void) $callback
* @return Batch
*/
public function before(Closure $callback): self
Expand All @@ -198,7 +198,7 @@ public function before(Closure $callback): self
/**
* Retrieve the before callback in the batch.
*
* @return \Closure|null
* @return (\Closure($this): void)|null
*/
public function beforeCallback(): ?Closure
{
Expand All @@ -208,7 +208,7 @@ public function beforeCallback(): ?Closure
/**
* Register a callback to run after a request from the batch succeeds.
*
* @param \Closure $callback
* @param (\Closure($this, int|string, \Illuminate\Http\Response): void) $callback
* @return Batch
*/
public function progress(Closure $callback): self
Expand All @@ -221,7 +221,7 @@ public function progress(Closure $callback): self
/**
* Retrieve the progress callback in the batch.
*
* @return \Closure|null
* @return (\Closure($this, int|string, \Illuminate\Http\Response): void)|null
*/
public function progressCallback(): ?Closure
{
Expand All @@ -231,7 +231,7 @@ public function progressCallback(): ?Closure
/**
* Register a callback to run after a request from the batch fails.
*
* @param \Closure $callback
* @param (\Closure($this, int|string, \Illuminate\Http\Response|\Illuminate\Http\Client\RequestException): void) $callback
* @return Batch
*/
public function catch(Closure $callback): self
Expand All @@ -244,7 +244,7 @@ public function catch(Closure $callback): self
/**
* Retrieve the catch callback in the batch.
*
* @return \Closure|null
* @return (\Closure($this, int|string, \Illuminate\Http\Response|\Illuminate\Http\Client\RequestException): void)|null
*/
public function catchCallback(): ?Closure
{
Expand All @@ -254,7 +254,7 @@ public function catchCallback(): ?Closure
/**
* Register a callback to run after all the requests from the batch succeed.
*
* @param \Closure $callback
* @param (\Closure($this, array<int|string, \Illuminate\Http\Response>): void) $callback
* @return Batch
*/
public function then(Closure $callback): self
Expand All @@ -267,7 +267,7 @@ public function then(Closure $callback): self
/**
* Retrieve the then callback in the batch.
*
* @return \Closure|null
* @return (\Closure($this, array<int|string, \Illuminate\Http\Response>): void)|null
*/
public function thenCallback(): ?Closure
{
Expand All @@ -277,7 +277,7 @@ public function thenCallback(): ?Closure
/**
* Register a callback to run after all the requests from the batch finish.
*
* @param \Closure $callback
* @param (\Closure($this, array<int|string, \Illuminate\Http\Response>): void) $callback
* @return Batch
*/
public function finally(Closure $callback): self
Expand All @@ -290,7 +290,7 @@ public function finally(Closure $callback): self
/**
* Retrieve the finally callback in the batch.
*
* @return \Closure|null
* @return (\Closure($this, array<int|string, \Illuminate\Http\Response>): void)|null
*/
public function finallyCallback(): ?Closure
{
Expand Down