On Tue, Aug 23, 2016 at 7:56 AM, Alexander Lisachenko <lisachenko...@gmail.com> wrote: > > 2016-08-23 16:40 GMT+03:00 Julien Pauli <jpa...@php.net>: >> >> My patch allows that, but I can't find a use case to it. > > > > My use case for that was decorating of static methods with additional > behaviour, so it's possible to cache the result of static methods, etc. > Unfortunately, reflection API doesn't provide me such an ability, so I > decided to switch to the combination of special closure with > forward_static_call_array() and binding it to the desired scope. > > > 2016-08-23 16:40 GMT+03:00 Julien Pauli <jpa...@php.net>: >> >> Try it. > > > Yes, sure, I will check. However as I say earlier, now I use closure > extraction and scope binding as more natural way to invoke such methods. So > missing scope argument for static methods and ReflectionMethod->invoke() is > a nice thing to have, but not a critical one.
Seems to me you should be calling getClosure() and using Closure::bindTo before invoking it. ReflectionMethod::invoke is really just a short-cut for a common case; I don't think it's reasonable to have it mirror the Closure API just to save one method call to get a Closure. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php