Tie together ErrorException severity and error constants (doc #63158)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@339185 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Peter Cowburn 2016-05-19 20:47:23 +00:00
parent 83153b3f58
commit ecf52eec24
2 changed files with 11 additions and 3 deletions

View file

@ -13,7 +13,7 @@
<modifier>public</modifier> <methodname>ErrorException::__construct</methodname>
<methodparam choice="opt"><type>string</type><parameter>message</parameter><initializer>""</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>code</parameter><initializer>0</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>severity</parameter><initializer>1</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>severity</parameter><initializer>E_ERROR</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>filename</parameter><initializer>__FILE__</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>lineno</parameter><initializer>__LINE__</initializer></methodparam>
<methodparam choice="opt"><type>Exception</type><parameter>previous</parameter><initializer>&null;</initializer></methodparam>
@ -49,6 +49,12 @@
<para>
The severity level of the exception.
</para>
<note>
<para>
While the severity can be any <type>integer</type> value, it is intended that the
<link linkend="errorfunc.constants">error constants</link> be used.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry>

View file

@ -39,9 +39,10 @@
<![CDATA[
<?php
try {
throw new ErrorException("Exception message", 0, 75);
throw new ErrorException("Exception message", 0, E_USER_ERROR);
} catch(ErrorException $e) {
echo "This exception severity is: " . $e->getSeverity();
var_dump($e->getSeverity() === E_USER_ERROR);
}
?>
]]>
@ -49,7 +50,8 @@ try {
&example.outputs.similar;
<screen>
<![CDATA[
This exception severity is: 75
This exception severity is: 256
bool(true)
]]>
</screen>
</example>