OutMiddleware without : RouteInterface requirements

I removed some : RouteInterface requirements to use OutMiddleware

// from response, array, string, int to accepttype
$app->group('',function($app){
    $app->get('foo', function(Request $request, Response $response, $args)
    {
        return response|string|array|int;
    });
})->add(function (Request $request, RequestHandler $handler) use($app) {
    $response = $handler->handle($request);
    if ($response instanceof Response) return $response;
    
    $response = $app->getResponseFactory()->createResponse();
    $response->getBody()->write(AcceptTypeRenderer($request, $response));
    return $response->withHeader('Content-type', AcceptType);
});

In ErrorHandler a similar approach.

It is a bad idea?