Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<VoidRelative class types>
^TypesLast updated: Mon, 26 Oct 2026

Never

never is a return-only type indicating the function does not terminate. This means that it either calls exit(), throws an exception, or is an infinite loop. Therefore, it cannot be part of a union type declaration. Available as of PHP 8.1.0.

A return statement in a never function is a compile-time error, even if the return would not be reached during execution. If control flow reaches the end of a never function without exiting, throwing an exception, or entering an infinite loop, a TypeError is thrown.

never is, in type theory parlance, the bottom type, meaning it is the subtype of every other type and can replace any other return type during inheritance.


<VoidRelative class types>
^TypesLast updated: Mon, 26 Oct 2026