1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-24 07:42:10 +01:00

Document ValueError thrown by settype() since PHP 8.0

Add Errors/Exceptions section and changelog entry.

Fixes php/doc-en#3431
This commit is contained in:
lacatoire
2026-02-18 11:38:51 +01:00
committed by Christian Weiske
parent ae90ecc932
commit 8d49e302b4

View File

@@ -87,6 +87,41 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws a <exceptionname>ValueError</exceptionname> if the value of
<parameter>type</parameter> is not a valid type, as of PHP 8.0.0.
Prior to PHP 8.0.0, a <constant>E_WARNING</constant> was emitted
and &false; was returned.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
Now throws a <exceptionname>ValueError</exceptionname> when an invalid
type is passed to <parameter>type</parameter>. Previously, a
<constant>E_WARNING</constant> was emitted and the function returned
&false;.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>