|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71082 Documentation is unclear on the other of use clause and return type declaration
Submitted: 2015-12-10 15:59 UTC Modified: 2015-12-19 04:19 UTC
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: lists dot ban at herbesfolles dot org Assigned: levim (profile)
Status: Assigned Package: Documentation problem
PHP Version: 7.0.0 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: lists dot ban at herbesfolles dot org
New email:
PHP Version: OS:


 [2015-12-10 15:59 UTC] lists dot ban at herbesfolles dot org
From manual page:

Syntax for mixing `use` Closure clause with return type declaration doesn't seem to be documented anywhere.  It's then unclear whether the `use` clause should come before (where PHP7 actually wants it) or after (where HHVM wants it) the return type hint.

    $closure = function (string $str) use (&$something) : int {}

    $closure = function (string $str) : int use (&$something) {}

As this not only isn't obvious, but also is inconsistent with what HHVM supports for some time, it seems very useful to me to document this clearly.

Test script:

$something = 42;
$closure = function (string $str) use (&$something) : int {
	return strlen($str) + $something;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-19 04:19 UTC]
-Assigned To: +Assigned To: levim
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 24 05:01:23 2021 UTC