From 65acc18cd9a93c677b48c8b1782f300e9602e00b Mon Sep 17 00:00:00 2001 From: Christoph Michael Becker Date: Thu, 13 Aug 2020 11:28:38 +0000 Subject: [PATCH] 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 --- language/functions.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/language/functions.xml b/language/functions.xml index a5ff99d522..016e0ea0ef 100644 --- a/language/functions.xml +++ b/language/functions.xml @@ -1040,7 +1040,10 @@ $newref =& returns_reference(); Strict typing 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 TypeError will be thrown. + In strict mode, the returned value must be of the correct type, otherwise a TypeError will be thrown.