logger->error('Unhandled exception', LogContext::withData([ 'exception_class' => get_class($exception), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'trace' => $exception->getTraceAsString() ])); return HandlerResult::create( handled: true, message: 'An unexpected error occurred', data: [ 'error_type' => 'unhandled', 'exception_class' => get_class($exception) ], isFinal: true, // Stop chain - this is the last resort statusCode: 500 ); } public function getName(): string { return 'fallback_error_handler'; } public function getPriority(): ErrorHandlerPriority { return ErrorHandlerPriority::LOWEST; } }