[DOC-CVS] [doc-en] master: Document ValueError thrown by settype() since PHP 8.0
[email protected] (lacatoire via Christian Weiske) Fri, 6 Mar 2026 12:07:46 +0000
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: lacatoire (lacatoire) Committer: Christian Weiske (cweiske) Date: 2026-03-06T13:07:44+01:00 Commit: https://github.com/php/doc-en/commit/8d49e302b484f0e5c237dd16ca1afef3b7515f46 Raw diff: https://github.com/php/doc-en/commit/8d49e302b484f0e5c237dd16ca1afef3b7515f46.diff Document ValueError thrown by settype() since PHP 8.0 Add Errors/Exceptions section and changelog entry. Fixes php/doc-en#3431 Changed paths: M reference/var/functions/settype.xml Diff: diff --git a/reference/var/functions/settype.xml b/reference/var/functions/settype.xml index 3700d30e64ab..0cf24423dc77 100644 --- a/reference/var/functions/settype.xml +++ b/reference/var/functions/settype.xml @@ -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>