Added Intial Return TypeError Doc & fix typo

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@337189 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Pasindu De Silva 2015-07-18 16:40:30 +00:00
parent 0ac74a54b9
commit 635e2ad129

View file

@ -937,7 +937,7 @@ var_dump($dis->two());
</para>
<para>
<example>
<title>Return a class;</title>
<title>Return a class</title>
<programlisting role="php">
<![CDATA[
<?php
@ -955,6 +955,30 @@ class B implements A {
</programlisting>
</example>
</para>
<para>
<example>
<title>TypeError</title>
<para>Incorrect return type will result in a TypeError</para>
<programlisting role="php">
<![CDATA[
<?php
declare(strict_types=1);
function show(): int{
return "1";
}
try {
show();
} catch (TypeError $e) {
var_dump($e->getMessage()); // string(121) "Return value of show() must be of the type integer,
// string returned in %s on line 5"
}
?>
]]>
</programlisting>
</example>
</para>
</sect2>
</sect1>