I need is to override a method for a single instance
I just can't override any method with the algorithms I took here: PHP override function of a single instance
My code:
class Test {
public function testFunc() {
echo "1";
}
}
$a = new Test();
# I tried another solution too and it doesn't work
$a->testFunc = Closure::bind(function() {
echo "2";
}, $a);
$a->testFunc();
After calling testFunc() I see 1, not 2.
Where is the mistake?