Doc #71082 [NEW]: Documentation is unclear on the other of use clause and return type declaration

From: Date: Thu, 10 Dec 2015 15:59:34 +0000
Subject: Doc #71082 [NEW]: Documentation is unclear on the other of use clause and return type declaration
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12927@lists.php.net to get a copy of this message
From: lists dot ban at herbesfolles dot org Operating system: PHP version: 7.0.0 Package: Documentation problem Bug Type: Documentation Problem Bug description:Documentation is unclear on the other of use clause and return type declaration Description: ------------ --- From manual page: http://www.php.net/functions.anonymous --- 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. PHP7: $closure = function (string $str) use (&$something) : int {} HHVM: $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: --------------- <?php $something = 42; $closure = function (string $str) use (&$something) : int { return strlen($str) + $something; }; -- Edit bug report at https://bugs.php.net/bug.php?id=71082&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71082&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71082&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71082&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71082&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71082&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71082&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71082&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71082&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71082&r=support Expected behavior: https://bugs.php.net/fix.php?id=71082&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71082&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71082&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71082&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71082&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71082&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71082&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71082&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71082&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71082&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71082&r=mysqlcfg

« previous php.doc.bugs (#12927) next »