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

Reply via email to