[doc-en] master: Document the PHP 8.5 core language features (#5824)
| From: | Louis-Arnaud via GitHub | Date: | Mon, 07 Sep 2026 08:04:23 +0000 |
| Subject: | [doc-en] master: Document the PHP 8.5 core language features (#5824) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23719@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-09-07T10:04:20+02:00
Commit: https://github.com/php/doc-en/commit/4c352e683436649edba35a3272210d8ca4cae611
Raw diff: https://github.com/php/doc-en/commit/4c352e683436649edba35a3272210d8ca4cae611.diff
Document the PHP 8.5 core language features (#5824)
Changed paths:
M language/constants.xml
M language/errors/basics.xml
M language/functions.xml
M language/types/callable.xml
Diff:
diff --git a/language/constants.xml b/language/constants.xml
index 1952120ddef5..bfd8e3d87e83 100644
--- a/language/constants.xml
+++ b/language/constants.xml
@@ -228,6 +228,33 @@ echo ANIMALS_DEF[1] . "\n"; // outputs "cat"
</para>
</note>
+ <sect2 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ Added support for type casts (e.g. <code>(int)</code>,
+ <code>(string)</code>) in constant expressions.
+ Also added support for
+ <link linkend="functions.anonymous">Closures</link> and
+ <link linkend="functions.first_class_callable_syntax">first-class
+ callables</link> in constant expressions.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect2>
+
<sect2 role="seealso">
&reftitle.seealso;
<para>
diff --git a/language/errors/basics.xml b/language/errors/basics.xml
index 5427244d93a2..5b31f247e8d7 100644
--- a/language/errors/basics.xml
+++ b/language/errors/basics.xml
@@ -75,6 +75,30 @@
as by sending an e-mail.
</para>
</sect2>
+
+ <sect2 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ Fatal errors (such as an exceeded maximum execution time) now include
+ a stack trace in their error message.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect2>
+
</sect1>
<!-- Keep this comment at the end of the file
diff --git a/language/functions.xml b/language/functions.xml
index 309e907c782c..5a8df8d6dc42 100644
--- a/language/functions.xml
+++ b/language/functions.xml
@@ -1416,6 +1416,13 @@ Stack trace:
</row>
</thead>
<tbody>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ Closures can now be used in constant expressions (e.g. default
+ property values, attribute parameters, constants).
+ </entry>
+ </row>
<row>
<entry>8.3.0</entry>
<entry>
@@ -1723,6 +1730,29 @@ $obj?->prop->method(...);
</informalexample>
</para>
</note>
+
+ <sect2 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ First-class callables can now be used in constant expressions
+ (e.g. default property values, attribute parameters, constants).
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </sect2>
</sect1>
</chapter>
diff --git a/language/types/callable.xml b/language/types/callable.xml
index a5530d55bf5d..a78d82274c06 100644
--- a/language/types/callable.xml
+++ b/language/types/callable.xml
@@ -160,6 +160,8 @@ print implode(' ', $new_numbers);
scope-independent and can always be invoked, whereas a callable type may be
scope-dependent and may not be directly invoked.
<classname>Closure</classname> is the preferred way to create callables.
+ As of PHP 8.5.0, <classname>Closure</classname> is a proper subtype of
+ <type>callable</type>.
</simpara>
<note>