📜  从不返回类型 - PHP 8.1 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:52.145000             🧑  作者: Mango

代码示例1
function redirect(string $uri): never {
    header('Location: ' . $uri);
    exit();
}

function redirectToLoginPage(): never {
    redirect('/login');
    echo 'Hello'; // <- dead code detected by static analysis
}