On 2016-08-23 16:20, Alexander Lisachenko wrote:
Ok, how can I invoke Parent::whoami() with reflection and get exactly "Child" as an output? class Parent { public static function whoami() { echo static::class; } } class Child extends Parent { public static function whoami() { echo "Don't call me now!'; parent::whoami(); } }
Could you do it without reflection, then? I don't think so. Thus, I think your "use case" is broken by design. If you need to call Parent::whoami with the Child scope, maybe you shouldn't override the method in Child class at all. If this kind of functionality is generally needed, maybe it could be borrowed from C++: obj_b->A::whoami(); Translated to PHP/Reflection: new ReflectionMethod("B", "A::whoami")->invoke(); -- Lauri Kenttä -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php