I'm trying to do something like this:
class A {
public function foo() {
$b = new B;
$b->invokeMethodFromAnotherObject(new ReflectionMethod($this, 'bar'));
}
public function bar() {
}
}
class B {
public function invokeMethodFromAnotherObject(ReflectionMethod $method) {
$method->invoke(?);
}
}
But there's no apparent way to "suck" $this back out of the reflection method, and I don't have a reference to the object in question. Is there a way I could do this without passing $this into B::invokeMethodFromAnotherObject?