mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Add documentation about the never type (#889)
This commit is contained in:
parent
ed6de1ae20
commit
975e9114e8
1 changed files with 16 additions and 0 deletions
|
@ -513,6 +513,22 @@ function foo(): X|Y {} // Allowed (redundancy is only known at runtime)
|
|||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="language.types.declarations.never">
|
||||
<title>never</title>
|
||||
<para>
|
||||
<literal>never</literal> is a return type indicating the function does not
|
||||
return. This means that it either calls <function>exit</function>, 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.
|
||||
</para>
|
||||
<para>
|
||||
<type>never</type> 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.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="language.types.declarations.static">
|
||||
<title>static</title>
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue