On 2016-08-23 18:45, Alexander Lisachenko wrote:
2016-08-23 18:05 GMT+03:00 Lauri Kenttä <lauri.ken...@gmail.com>:

Could you do it without reflection, then? I don't think so.
Thus, I think your "use case" is broken by design.

FYI: This use case is used by Go! AOP Framework and AspectMock
libraries that can mock even static methods in the classes, allowing
testing legacy code and singletons. If you are interested in how it
works, then you could look at this example: https://3v4l.org/TbS5V

Ok, so I was wrong about it being impossible. Sorry about that.
However, if you look at that example, does it look good and solid?
It looks more like a weird hack to me.

So I stand by my words: if there's a legitimate use for calling
parent static methods with child context, there should also be
simpler ways than reflection or strange closure hacks for doing it.
There should be a syntax like ChildClass::ParentClass::method(),
or at least call_user_func(["ChildClass", "ParentClass", "method"]),
or call_user_func(["ChildClass", "ParentClass::method"]), since the
ParentClass can be considered a qualifier for the method name.

--
Lauri Kenttä

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to