The response is not a hard dependency of the FlattenException, this is true. But it is a hard dependency of the ExceptionHandler. You cannot register the exception handler without HttpFoundation