diff --git a/language/functions.xml b/language/functions.xml
index dfa0a59231..c5cc4613fe 100644
--- a/language/functions.xml
+++ b/language/functions.xml
@@ -1049,6 +1049,8 @@ $greet('PHP');
variables must be passed to the use language construct.
As of PHP 7.1, these variables must not include &link.superglobals;,
$this, or variables with the same name as a parameter.
+ A return type declaration of the function has to be placed
+ after the use clause.
@@ -1094,6 +1096,12 @@ $example = function ($arg) use ($message) {
var_dump($arg . ' ' . $message);
};
$example("hello");
+
+// Return type declaration comes after the use clause
+$example = function () use ($message): string {
+ return "hello $message";
+};
+var_dump($example());
?>
]]>
@@ -1107,6 +1115,7 @@ string(5) "hello"
string(5) "hello"
string(5) "world"
string(11) "hello world"
+string(11) "hello world"
]]>