if (!
$this->exceptionHandler
) { if ($event instanceof KernelEvent
) { if (method_exists($kernel =
$event->
getKernel(), 'terminateWithException'
)) { $request =
$event->
getRequest();
$hasRun = &
$this->hasTerminatedWithException;
$this->exceptionHandler =
static function D\Throwable
$e) use ($kernel,
$request, &
$hasRun) { if ($hasRun) { throw $e;
} $hasRun = true;
$kernel->
terminateWithException($e,
$request);
};
} } elseif ($event instanceof ConsoleEvent &&
$app =
$event->
getCommand()->
getApplication()) { $output =
$event->
getOutput();
if ($output instanceof ConsoleOutputInterface
) { $output =
$output->
getErrorOutput();
} $this->exceptionHandler =
static function D\Throwable
$e) use ($app,
$output) { $app->
renderThrowable($e,
$output);
};
} }