Repository: laravel/framework
File: src/Illuminate/Http/Client/PendingRequest.php (PHP)

Code before:
    }

    /**
     * Issue a DELETE request to the given URL.
     *
     * @param  string  $url
     * @param  array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable  $data
     * @return \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface
     *
     * @throws \Illuminate\Http\Client\ConnectionException
     */
    public function delete(string $url, $data = [])
    {
        return $this->send('DELETE', $url, empty($data) ? [] : [
            $this->bodyFormat => $data,
        ]);
    }

    /**
     * Send a pool of asynchronous requests concurrently.
     *
     * @param  (callable(\Illuminate\Http\Client\Pool): mixed)  $callback
     * @param  non-negative-int|null  $concurrency
     * @return array<array-key, \Illuminate\Http\Client\Response|\Illuminate\Http\Client\ConnectionException|\Illuminate\Http\Client\RequestException>
     */
    public function pool(callable $callback, ?int $concurrency = 0)
    {
        $results = [];

        $requests = tap(new Pool($this->factory), $callback)->getRequests();

        if ($concurrency === null) {
            (new Collection($requests))->each(function ($item) {
                if ($item instanceof static) {
                    $item = $item->getPromise();
                }
                if ($item instanceof LazyPromise) {
                    $item->buildPromise();
                }
            });
            foreach ($requests as $key => $item) {
                $results[$key] = $item instanceof static ? $item->getPromise()->wait() : $item->wait();
            }

            return $results;
        }

        $concurrency = $concurrency === 0 ? count($requests) : $concurrency;

        (new Collection($requests))->chunk($concurrency)
            ->each(static function (Collection $requests) use ($concurrency, &$results) {

Review comment (suggestion):
@taylorotwell the change to 0 for the default probably breaks existing code and maybe we should just forego it until Laravel 13.

Code after:
    }

    /**
     * Issue a DELETE request to the given URL.
     *
     * @param  string  $url
     * @param  array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable  $data
     * @return \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface
     *
     * @throws \Illuminate\Http\Client\ConnectionException
     */
    public function delete(string $url, $data = [])
    {
        return $this->send('DELETE', $url, empty($data) ? [] : [
            $this->bodyFormat => $data,
        ]);
    }

    /**
     * Send a pool of asynchronous requests concurrently.
     *
     * @param  (callable(\Illuminate\Http\Client\Pool): mixed)  $callback
     * @param  non-negative-int|null  $concurrency
     * @return array<array-key, \Illuminate\Http\Client\Response|\Illuminate\Http\Client\ConnectionException|\Illuminate\Http\Client\RequestException>
     */
    public function pool(callable $callback, ?int $concurrency = null)
    {
        $results = [];

        $requests = tap(new Pool($this->factory), $callback)->getRequests();

        if ($concurrency === null) {
            (new Collection($requests))->each(static function ($item) {
                if ($item instanceof static) {
                    $item = $item->getPromise();
                }

                if ($item instanceof LazyPromise) {
                    $item->buildPromise();
                }
            });

            foreach ($requests as $key => $item) {
                $results[$key] = $item instanceof static ? $item->getPromise()->wait() : $item->wait();
            }

            return $results;
        }

        $concurrency = $concurrency === 0 ? count($requests) : $concurrency;