Thanks Nathaniel for the clarification about 5.4. We are still on 5.3 (and
that only recently), so 5.4 is a ways off in our production systems.
However, I'll read up on this since it may be useful in offline tools.
On Fri, May 31, 2013 at 11:52 AM, Nick Whiting wrote:
> TestClass::testMethod(func
This will not work.
As stated in the PHP documentation "Static closures cannot have any bound
object "
A static Closure has no context of "this" just as with any other static
object.
A workaround is to pass in the Closure as a parameter to achieve a similar
result.
class TestClass {
public
I'm talking about PHP 5.4. `bindTo` is a Closure method in PHP 5.4, and
allows you to set the `$this` variable inside of a Closure. However,
apparently you can't use it on Closures created inside static methods.
I knew that you could create another function which would return the
Closure, however,
On Fri, May 31, 2013 at 10:54 AM, Nathaniel Higgins wrote:
> Is it possible to bind an instance to a static closure, or to create a
> non-static closure inside of a static class method?
>
PHP doesn't have a method to do this. In JavaScript you can use jQuery's
var func = $.proxy(function ()
4 matches
Mail list logo