Req #62078 [Opn->Csd]: Closure instantiation and chaining
| From: | requinix@php.net | Date: | Sat, 10 Jan 2015 22:56:53 +0000 |
| Subject: | Req #62078 [Opn->Csd]: Closure instantiation and chaining | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-189873@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62078&edit=1
ID: 62078
Updated by: requinix@php.net
Reported by: dan dot lugg at gmail dot com
Summary: Closure instantiation and chaining
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: Class/Object related
PHP Version: 5.4.3
-Assigned To:
+Assigned To: requinix
Block user comment: N
Private report: N
New Comment:
Fixed in PHP 7. http://3v4l.org/lPHbE
Previous Comments:
------------------------------------------------------------------------
[2012-05-20 17:36:17] dan dot lugg at gmail dot com
I apologize if the bug category is not correct; there didn't appear to be a "Syntax"
category or related.
------------------------------------------------------------------------
[2012-05-20 17:34:36] dan dot lugg at gmail dot com
Description:
------------
When you "instantiate" a closure through the function(){} syntax, you cannot chain
the closure method bindTo() from the instantiation. While this is trivial,
considering static Closure::bind(), it seems inconsistent with efforts to allow
method invocation on instantiation of other objects.
Test script:
---------------
$function = (function(){ /* ... */ })->bindTo($object);
Expected result:
----------------
$function should contain the instantiated and re-bound closure.
Actual result:
--------------
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62078&edit=1