Resolve doc bug #71167

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@338328 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Thomas Punt 2015-12-19 20:00:23 +00:00
parent c72e6502c8
commit 20f201c32c

View file

@ -366,8 +366,8 @@ Making a bowl of acidophilus raspberry.
</note>
<para>
Type declarations allow functions to require that parameters are of a
certain type at call time. If the given value is of the incorrect type,
Type declarations allow functions to specify parameters as certain types.
If the given value is of the incorrect type,
then an error is generated: in PHP 5, this will be a recoverable fatal
error, while PHP 7 will throw a <classname>TypeError</classname>
exception.
@ -453,6 +453,35 @@ Making a bowl of acidophilus raspberry.
</tbody>
</tgroup>
</informaltable>
<warning>
<para>
Aliases for the above scalar types are not supported. Instead, they are
treated as class or interface names. For example, using
<literal>boolean</literal> as a parameter or return type will require
an argument or return value that is an &instanceof; the class or
interface <literal>boolean</literal>, rather than of type
<type>bool</type>:
</para>
<para>
<example>
<programlisting role="php">
<![CDATA[
<?php
function test(boolean $param) {}
test(true);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Fatal error: Uncaught TypeError: Argument 1 passed to test() must be an instance of boolean, boolean given, called in - on line 1 and defined in -:1
]]>
</screen>
</example>
</para>
</warning>
</sect3>
<sect3 xml:id="functions.arguments.type-declaration.examples">