Skip to content

Commit 2f3c123

Browse files
authored
errorexception.xml: remove the extra dot cahr; combed the example code (#3539)
1 parent 44bcc82 commit 2f3c123

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

language/predefined/errorexception.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,30 @@
7777
&reftitle.examples;
7878
<para>
7979
<example xml:id="errorexception.example.error-handler"><!-- {{{ -->
80-
<title>Use <function>set_error_handler</function> to change error messages into ErrorException.</title>
80+
<title>Use <function>set_error_handler</function> to change error messages into ErrorException</title>
8181
<programlisting role="php">
8282
<![CDATA[
8383
<?php
84+
8485
set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline) {
8586
if (!(error_reporting() & $errno)) {
8687
// This error code is not included in error_reporting.
8788
return;
8889
}
90+
8991
if ($errno === E_DEPRECATED || $errno === E_USER_DEPRECATED) {
9092
// Do not throw an Exception for deprecation warnings as new or unexpected
9193
// deprecations would break the application.
9294
return;
9395
}
96+
9497
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
9598
});
9699
97100
// Unserializing broken data triggers a warning which will be turned into an
98101
// ErrorException by the error handler.
99102
unserialize('broken data');
103+
100104
?>
101105
]]>
102106
</programlisting>

0 commit comments

Comments
 (0)