Repository: laravel/framework
File: src/Illuminate/Bus/PendingBatch.php (PHP)

Code before:
     */
    public function finally($callback)
    {
        $this->options['finally'][] = $callback instanceof Closure
            ? new SerializableClosure($callback)
            : $callback;

        return $this;
    }

    /**
     * Get the "finally" callbacks that have been registered with the pending batch.
     *
     * @return array
     */
    public function finallyCallbacks()
    {
        return $this->options['finally'] ?? [];
    }

    /**
     * Indicate that the batch should not be cancelled when a job within the batch fails;
     * optionally add callbacks to be executed upon each job failure (this may be useful for
     * running other jobs when a job fails).
     */
    public function allowFailures(bool|callable|Closure|array $param = true): self
    {
        if (! is_bool($param)) {
            $param = Arr::wrap($param);

            foreach ($param as $callback) {
                $this->options['failure'][] = $callback instanceof Closure
                    ? new SerializableClosure($callback)
                    : $callback;
            }
        }

        $this->options['allowFailures'] = (bool) $param;

        return $this;
    }

    /**
     * Determine if the pending batch allows jobs to fail without cancelling the batch.
     *
     * @return bool
     */
    public function allowsFailures()
    {
        return Arr::get($this->options, 'allowFailures', false) === true;
    }

Review comment (bug):
You can narrow the `array` type further down
```suggestion
     * Indicate that the batch should not be cancelled when a job within the batch fails;
     * optionally add callbacks to be executed upon each job failure (this may be useful for
     * running other jobs when a job fails).
     *
     * @param  bool|callable|Closure|array<array-key, callable|Closure>  $param
     */
    public function allowFailures(bool|callable|Closure|array $param = true): self
```

Code after:
    /**
     * Get the "finally" callbacks that have been registered with the pending batch.
     *
     * @return array
     */
    public function finallyCallbacks()
    {
        return $this->options['finally'] ?? [];
    }

    /**
     * Indicate that the batch should not be canceled when a job within the batch fails.
     *
     * Optionally, add callbacks to be executed upon each job failure.
     *
     * @template TParam of Closure(\Illuminate\Bus\Batch, \Throwable|null): mixed)|(callable(\Illuminate\Bus\Batch, \Throwable|null): mixed)
     *
     * @param  bool|TParam|array<array-key, TParam>  $param
     * @return $this
     */
    public function allowFailures(Closure|callable|array|bool $param = true)
    {
        if (! is_bool($param)) {
            $param = Arr::wrap($param);

            foreach ($param as $callback) {
                if (is_callable($callback)) {
                    $this->registerCallback('failure', $callback);
                }
            }
        }

        $this->options['allowFailures'] = ! ($param === false);

        return $this;
    }

    /**
     * Determine if the pending batch allows jobs to fail without cancelling the batch.
     *
     * @return bool
     */
    public function allowsFailures()
    {
        return Arr::get($this->options, 'allowFailures', false) === true;
    }

    /**
     * Get the "failure" callbacks that have been registered with the pending batch.
     *
     * @return array<array-key, Closure|callable>