InstrumentationGuard
API reference › Debug Core › Instrumentation › InstrumentationGuard
Executes diagnostic observers without allowing their failures to alter application behavior.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a guard around an optional diagnostic failure observer. | InstrumentationGuard |
observe() | Runs one diagnostic observer and reports, but never propagates, its failure. | InstrumentationGuard |
report() | Reports a failure that was already caught, keeping the handler itself fail-open. | InstrumentationGuard |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(callable(Throwable): void|null $failureHandler = null)Creates a guard around an optional diagnostic failure observer.
Parameters
| Parameter | Type | Description |
|---|---|---|
$failureHandler | callable(Throwable): void| | Optional observer for suppressed instrumentation errors. |
observe()
Section titled “observe() ”public function observe(callable(): void $observer): voidRuns one diagnostic observer and reports, but never propagates, its failure.
Parameters
| Parameter | Type | Description |
|---|---|---|
$observer | callable(): void | Diagnostic side effect. |
report()
Section titled “report() ”public function report(Throwable $failure): voidReports a failure that was already caught, keeping the handler itself fail-open.
Parameters
| Parameter | Type | Description |
|---|---|---|
$failure | Throwable | Suppressed instrumentation failure. |