Clarify behavior of wrong return types in weak mode

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@350301 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christoph Michael Becker 2020-08-13 11:28:38 +00:00
parent c6a8e42bdb
commit 65acc18cd9

View file

@ -1040,7 +1040,10 @@ $newref =& returns_reference();
<link linkend="functions.arguments.type-declaration.strict">Strict typing</link>
also has an effect on return type declarations. In the default weak mode,
returned values will be coerced to the correct type if they are not
already of that type. In strong mode, the returned value must be of the
already of that type. If this type conversion is not allowed
(e.g. when returning an &array; from a function with return type &integer;),
a <classname>TypeError</classname> will be thrown.
In strict mode, the returned value must be of the
correct type, otherwise a <classname>TypeError</classname> will be thrown.
</para>