Never Type

never is a special return type that signals a method that never returns: it only dies, throws an exception or runs an infinite loop.

never is the lowest type available. Nothing can be a sub-type of never but never can be the subtype of anything.

<?php

function headers() : never {
    headers('Location: https://www.exakat.io/');
    die();
}

?>

Documentation

See also The never Return Type for PHP and Using ‘never’ return type in PHP (PHP 8.1+).

Related : Type System, PHP Natives, Return Value, Special Types

Added in PHP 8.1+