Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
DeferredCallbackFailed
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5/**
6 * This file is part of fast-forward/defer.
7 *
8 * This source file is subject to the license bundled
9 * with this source code in the file LICENSE.
10 *
11 * @copyright Copyright (c) 2026 Felipe SayĆ£o Lobato Abreu <github@mentordosnerds.com>
12 * @license   https://opensource.org/licenses/MIT MIT License
13 *
14 * @see       https://github.com/php-fast-forward/defer
15 * @see       https://github.com/php-fast-forward
16 * @see       https://datatracker.ietf.org/doc/html/rfc2119
17 */
18
19namespace FastForward\Defer\EventDispatcher\Event;
20
21use Throwable;
22
23/**
24 * Event representing a failed deferred callback execution.
25 *
26 * This event MUST be dispatched whenever a deferred callback throws an exception.
27 * It SHALL encapsulate the throwable, the callback description, and the callback arguments.
28 * Consumers of this event MUST NOT modify its properties.
29 */
30readonly class DeferredCallbackFailed
31{
32    /**
33     * Constructs a new DeferredCallbackFailed event.
34     *
35     * @param Throwable $throwable the exception thrown by the callback
36     * @param string|null $callback the description of the callback, if available
37     * @param array $arguments the arguments passed to the callback
38     */
39    public function __construct(
40        public Throwable $throwable,
41        public ?string $callback = null,
42        public array $arguments = [],
43    ) {}
44}