Bug #62078 [Com]: Closure instantiation and chaining
| From: | dan dot lugg at gmail dot com | Date: | Sun, 20 May 2012 17:36:17 +0000 |
| Subject: | Bug #62078 [Com]: Closure instantiation and chaining | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-170610@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
Comment by: dan dot lugg at gmail dot com
Reported by: dan dot lugg at gmail dot com
Summary: Closure instantiation and chaining
Status: Open
Type: Bug
Package: Class/Object related
PHP Version: 5.4.3
Block user comment: N
Private report: N
New Comment:
I apologize if the bug category is not correct; there didn't appear to be a "Syntax"
category or related.
Previous Comments:
------------------------------------------------------------------------
[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