Cannot rebind scope of closure created from method¶
Description¶
When a closure is build from a method and an existing object, it is not possible to rebind it to another object.
Example¶
<?php
class X {
function method () {}
}
class Y {}
$x = new X;
$fn = $x->method(...);
$ret = $fn->bindTo($x, Y::class);
?>
Solutions¶
To be rebound, the closure must be build from within the class.