This error reporter implementation MUST dispatch all reported exceptions as events using a PSR-14 compatible event dispatcher.
Description
It SHALL provide a detailed event including the exception, callback description, and arguments. If the dispatcher throws an exception, this class MUST log the failure using error_log and MUST NOT throw further exceptions.
Interfaces
This interface MUST be implemented by any class that reports exceptions from deferred callbacks.
Properties
Methods
Constructs a new PsrEventDispatcherErrorReporter instance.
Reports a throwable by dispatching a DeferredCallbackFailed event.
Constructs a new PsrEventDispatcherErrorReporter instance.
public
__construct(EventDispatcherInterface
$dispatcher) : mixed
Parameters
$dispatcher
:
EventDispatcherInterface
Description
the PSR-14 event dispatcher to use for error reporting
Reports a throwable by dispatching a DeferredCallbackFailed event.
public
report(Throwable
$throwable[,
callable|null
$callback = null][,
array<string|int, mixed>
$args = []]) : void
Description
This method MUST dispatch the exception as an event. If the dispatcher fails, the error MUST be logged.
Parameters
$throwable
:
Throwable
Description
the exception or error to report
$callback
:
callable|null
=
null
Description
the related callback, if available
$args
:
array<string|int, mixed>
=
[]
Description
arguments passed to the callback, if any