Replace the code from the first block with the code of the second ones.
<?php
declare(strict_types=1);
namespace App;
use Chubbyphp\Framework\Application;
use Chubbyphp\Framework\ExceptionHandler;
use Chubbyphp\Framework\Middleware\MiddlewareDispatcher;
use Chubbyphp\Framework\Router\FastRouteRouter;
$app = new Application(
new FastRouteRouter([$route]),
new MiddlewareDispatcher(),
new ExceptionHandler($responseFactory, true)
);
<?php
declare(strict_types=1);
namespace App;
use Chubbyphp\Framework\Application;
use Chubbyphp\Framework\Middleware\ExceptionMiddleware;
use Chubbyphp\Framework\Middleware\RouterMiddleware;
use Chubbyphp\Framework\Router\FastRouteRouter;
$app = new Application([
new ExceptionMiddleware($responseFactory, true),
new RouterMiddleware(new FastRouteRouter([$route]), $responseFactory),
]);