src/Valkyrja/Valkyrja.php
public function redirect(
        string $uri = null,
        int $statusCode = StatusCode::FOUND,
        array $headers = []
    ): RedirectResponse {
        /** @var RedirectResponse $response */
        $response = $this->container()->getSingleton(RedirectResponse::class);

        if (\func_num_args() === 0) {
            return $response;
        }

        return $response->createRedirect($uri, $statusCode, $headers);
    }
public function redirect(
        string $uri = null,
        int $statusCode = StatusCode::FOUND,
        array $headers = []
    ): RedirectResponse {
        /** @var RedirectResponse $response */
        $response = $this->container()->getSingleton(RedirectResponse::class);

        if (\func_num_args() === 0) {
            return $response;
        }

        return $response->createRedirect($uri, $statusCode, $headers);
    }
Return a new json response from the application.

@param string $uri        [optional] The URI to redirect to
@param int    $statusCode [optional] The response status code
@param array  $headers    [optional] An array of response headers

@throws \InvalidArgumentException
@throws \Valkyrja\Http\Exceptions\InvalidStatusCodeException

@return \Valkyrja\Http\RedirectResponse