app = $app; $this->container = $container; } /** * Set up and configure exception handling. * * @return void */ public function __invoke(): void { if ($this->container->get('debug')) { return; } $errorMiddleware = $this->app->addErrorMiddleware(true, true, true); $errorMiddleware->setDefaultErrorHandler(ErrorHandler::class); } }