Skip to content

Commit a8a9961

Browse files
authored
Mention deprecation of implicit nullable types in function docs (#4008)
1 parent d345611 commit a8a9961

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

language/functions.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,9 @@ Making a bowl of raspberry natural yogurt.
454454
dropping the default value, since it will never be used.
455455
One exception to this rule are arguments of the form
456456
<code>Type $param = null</code>, where the &null; default makes the type implicitly
457-
nullable. This usage remains allowed, though it is recommended to use an
458-
explicit <link linkend="language.types.declarations.nullable">nullable type</link> instead.
457+
nullable. This usage is deprecated as of PHP 8.4.0, and an explicit
458+
<link linkend="language.types.declarations.nullable">nullable type</link>
459+
should be used instead.
459460
<example>
460461
<title>Declaring optional arguments after mandatory arguments</title>
461462
<programlisting role="php">
@@ -464,7 +465,7 @@ Making a bowl of raspberry natural yogurt.
464465
function foo($a = [], $b) {} // Default not used; deprecated as of PHP 8.0.0
465466
function foo($a, $b) {} // Functionally equivalent, no deprecation notice
466467
467-
function bar(A $a = null, $b) {} // Still allowed; $a is required but nullable
468+
function bar(A $a = null, $b) {} // Deprecated as of PHP 8.4.0; $a is required but nullable
468469
function bar(?A $a, $b) {} // Recommended
469470
?>
470471
]]>

0 commit comments

Comments
 (0)