Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Never return type - PHP 8.1

function redirect(string $uri): never {
    header('Location: ' . $uri);
    exit();
}

function redirectToLoginPage(): never {
    redirect('/login');
    echo 'Hello'; // <- dead code detected by static analysis
}
Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #Never #return #type #PHP
ADD COMMENT
Topic
Name
1+1 =