Skip to content

Commit d65ba8c

Browse files
committed
Document the PHP 8.5 core language features
1 parent 623a270 commit d65ba8c

4 files changed

Lines changed: 83 additions & 0 deletions

File tree

language/constants.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,33 @@ echo ANIMALS_DEF[1] . "\n"; // outputs "cat"
222222
</para>
223223
</note>
224224

225+
<sect2 role="changelog">
226+
&reftitle.changelog;
227+
<informaltable>
228+
<tgroup cols="2">
229+
<thead>
230+
<row>
231+
<entry>&Version;</entry>
232+
<entry>&Description;</entry>
233+
</row>
234+
</thead>
235+
<tbody>
236+
<row>
237+
<entry>8.5.0</entry>
238+
<entry>
239+
Added support for type casts (e.g. <code>(int)</code>,
240+
<code>(string)</code>) in constant expressions.
241+
Also added support for
242+
<link linkend="functions.anonymous">Closures</link> and
243+
<link linkend="functions.first_class_callable_syntax">first-class
244+
callables</link> in constant expressions.
245+
</entry>
246+
</row>
247+
</tbody>
248+
</tgroup>
249+
</informaltable>
250+
</sect2>
251+
225252
<sect2 role="seealso">
226253
&reftitle.seealso;
227254
<para>

language/errors/basics.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,30 @@
7575
as by sending an e-mail.
7676
</para>
7777
</sect2>
78+
79+
<sect2 role="changelog">
80+
&reftitle.changelog;
81+
<informaltable>
82+
<tgroup cols="2">
83+
<thead>
84+
<row>
85+
<entry>&Version;</entry>
86+
<entry>&Description;</entry>
87+
</row>
88+
</thead>
89+
<tbody>
90+
<row>
91+
<entry>8.5.0</entry>
92+
<entry>
93+
Fatal errors (such as an exceeded maximum execution time) now include
94+
a stack trace in their error message.
95+
</entry>
96+
</row>
97+
</tbody>
98+
</tgroup>
99+
</informaltable>
100+
</sect2>
101+
78102
</sect1>
79103

80104
<!-- Keep this comment at the end of the file

language/functions.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,13 @@ Stack trace:
14081408
</row>
14091409
</thead>
14101410
<tbody>
1411+
<row>
1412+
<entry>8.5.0</entry>
1413+
<entry>
1414+
Closures can now be used in constant expressions (e.g. default
1415+
property values, attribute parameters, constants).
1416+
</entry>
1417+
</row>
14111418
<row>
14121419
<entry>8.3.0</entry>
14131420
<entry>
@@ -1715,6 +1722,29 @@ $obj?->prop->method(...);
17151722
</informalexample>
17161723
</para>
17171724
</note>
1725+
1726+
<sect2 role="changelog">
1727+
&reftitle.changelog;
1728+
<informaltable>
1729+
<tgroup cols="2">
1730+
<thead>
1731+
<row>
1732+
<entry>&Version;</entry>
1733+
<entry>&Description;</entry>
1734+
</row>
1735+
</thead>
1736+
<tbody>
1737+
<row>
1738+
<entry>8.5.0</entry>
1739+
<entry>
1740+
First-class callables can now be used in constant expressions
1741+
(e.g. default property values, attribute parameters, constants).
1742+
</entry>
1743+
</row>
1744+
</tbody>
1745+
</tgroup>
1746+
</informaltable>
1747+
</sect2>
17181748
</sect1>
17191749

17201750
</chapter>

language/types/callable.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ print implode(' ', $new_numbers);
160160
scope-independent and can always be invoked, whereas a callable type may be
161161
scope-dependent and may not be directly invoked.
162162
<classname>Closure</classname> is the preferred way to create callables.
163+
As of PHP 8.5.0, <classname>Closure</classname> is a proper subtype of
164+
<type>callable</type>.
163165
</simpara>
164166

165167
<note>

0 commit comments

Comments
 (0)