Suppose I have this class with these methods...
Class Foo {
public function bar {
return 'foo';
}
public function nothing {
//Nothing.
}
}
How would I go about defining the nothing method with the bar method, assuming I cannot manipulate anything but the bar method?
I've exhausted my google-fu and haven't found anything useful, but I get the sense that I just don't know the proper terminology to find an appropriate answer. Thanks in advance for the help!
ANSWERED in comments - thank you!
Here's a secondary question...assuming you could manipulate anything other than the nothing method, what would be the appropriate way of defining it?
Not wanting to steal Paul's thunder here - his answer is correct, and the point about XY problem is very pertinent, but...
Runkit is not a standard part of PHP and likely never will be. Closures, callbacks and the _call magic method are. Between them these should provide provide the ability to achieve most of the outcomes you would use runkit for on PHP code other than builti-ins. The only snag being that you can no longer use $this as a variable name in a functions argument list.