Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(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 | |
| 19 | namespace FastForward\Defer; |
| 20 | |
| 21 | use Throwable; |
| 22 | |
| 23 | /** |
| 24 | * This interface MUST be implemented by any class that reports exceptions from deferred callbacks. |
| 25 | * Implementations SHALL provide a report() method that handles the throwable, callback, and arguments. |
| 26 | */ |
| 27 | interface ErrorReporterInterface |
| 28 | { |
| 29 | /** |
| 30 | * Reports an exception from a deferred callback. |
| 31 | * |
| 32 | * This method MUST handle the throwable and MAY use the callback and arguments for context. |
| 33 | * |
| 34 | * @param Throwable $throwable the exception to report |
| 35 | * @param callable|null $callback the related callback, if available |
| 36 | * @param array $arguments arguments passed to the callback, if any |
| 37 | * |
| 38 | * @return void |
| 39 | */ |
| 40 | public function report(Throwable $throwable, ?callable $callback = null, array $arguments = []): void; |
| 41 | } |