Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-25 Thread Christoph M. Becker
On 23.08.2016 at 17:03, Ferenc Kovacs wrote: > personally I think that we are in general too lenient with allowing BC > breaks in 7.1 (even though that I somehow expected this and was arguing for > a longer release cycle for 7.0 or at least having a clear roadmap for the > next major version) and

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Lauri Kenttä
On 2016-08-23 18:45, Alexander Lisachenko wrote: 2016-08-23 18:05 GMT+03:00 Lauri Kenttä : 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

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Alexander Lisachenko
2016-08-23 18:05 GMT+03:00 Lauri Kenttä : > 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 testi

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Julien Pauli
On Tue, Aug 23, 2016 at 4:58 PM, Levi Morrison wrote: > On Tue, Aug 23, 2016 at 8:49 AM, Julien Pauli wrote: >> On Tue, Aug 23, 2016 at 4:13 PM, Levi Morrison wrote: >>> On Tue, Aug 23, 2016 at 7:56 AM, Alexander Lisachenko >>> wrote: 2016-08-23 16:40 GMT+03:00 Julien Pauli : > >>

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Lauri Kenttä
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()

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Levi Morrison
On Tue, Aug 23, 2016 at 8:49 AM, Julien Pauli wrote: > On Tue, Aug 23, 2016 at 4:13 PM, Levi Morrison wrote: >> On Tue, Aug 23, 2016 at 7:56 AM, Alexander Lisachenko >> wrote: >>> >>> 2016-08-23 16:40 GMT+03:00 Julien Pauli : My patch allows that, but I can't find a use case to it. >>>

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Julien Pauli
On Tue, Aug 23, 2016 at 4:13 PM, Levi Morrison wrote: > On Tue, Aug 23, 2016 at 7:56 AM, Alexander Lisachenko > wrote: >> >> 2016-08-23 16:40 GMT+03:00 Julien Pauli : >>> >>> My patch allows that, but I can't find a use case to it. >> >> >> >> My use case for that was decorating of static methods

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Levi Morrison
On Tue, Aug 23, 2016 at 7:56 AM, Alexander Lisachenko wrote: > > 2016-08-23 16:40 GMT+03:00 Julien Pauli : >> >> 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

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Alexander Lisachenko
2016-08-23 16:40 GMT+03:00 Julien Pauli : > 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 suc

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Julien Pauli
On Tue, Aug 23, 2016 at 3:20 PM, Alexander Lisachenko wrote: > > 2016-08-23 16:13 GMT+03:00 Julien Pauli : >> >> >> No, How can this be ? B extends A , not A extends B ... >> In this case, B'sfoo() will be called , which is the equivalent to >> having a reflectionMethod from B , so useless to me.

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Rowan Collins
On 23/08/2016 14:20, Alexander Lisachenko wrote: 2016-08-23 16:13 GMT+03:00 Julien Pauli mailto:jpa...@php.net>>: No, How can this be ? B extends A , not A extends B ... In this case, B'sfoo() will be called , which is the equivalent to having a reflectionMethod from B , so useles

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Alexander Lisachenko
2016-08-23 16:13 GMT+03:00 Julien Pauli : > > No, How can this be ? B extends A , not A extends B ... > In this case, B'sfoo() will be called , which is the equivalent to > having a reflectionMethod from B , so useless to me. Ok, how can I invoke Parent::whoami() with reflection and get exactl

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Rowan Collins
On 23/08/2016 13:56, Alexander Lisachenko wrote: For static methods this could be object (why not - it will be ignored) Allowing a parameter and then completely ignoring it is what got us into this situation in the first place. Why does this... $a = new reflectionMethod('A', 'foo'); $a->inv

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Julien Pauli
On Tue, Aug 23, 2016 at 3:07 PM, Alexander Lisachenko wrote: > > 2016-08-23 16:01 GMT+03:00 Julien Pauli : >> >> This : >> >> class A { public static function foo() { } } >> class B extends A { public static function foo() { } } >> >> $a = new reflectionMethod('A', 'foo'); >> $a->invoke('B'); > >

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Alexander Lisachenko
2016-08-23 16:01 GMT+03:00 Julien Pauli : > This : > > class A { public static function foo() { } } > class B extends A { public static function foo() { } } > > $a = new reflectionMethod('A', 'foo'); > $a->invoke('B'); > It's perfect way for me. Just to be sure: in this case we will invoke A::f

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Julien Pauli
On Tue, Aug 23, 2016 at 2:56 PM, Alexander Lisachenko wrote: > > 2016-08-23 14:51 GMT+03:00 Christoph M. Becker : >> >> I suggest to deprecate all other types than NULL as first arg for static >> methods, because passing an int, for instance, makes even less sense as >> Rowan has already pointed o

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Alexander Lisachenko
2016-08-23 14:51 GMT+03:00 Christoph M. Becker : > I suggest to deprecate all other types than NULL as first arg for static > methods, because passing an int, for instance, makes even less sense as > Rowan has already pointed out elsewhere in this thread. > Alternative suggestion (vote for Julie

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Julien Pauli
On Tue, Aug 23, 2016 at 1:51 PM, Christoph M. Becker wrote: > On 23.08.2016 at 13:36, Julien Pauli wrote: > >> On Tue, Aug 23, 2016 at 10:30 AM, Christoph M. Becker >> wrote: >> >>> On 23.08.2016 at 00:25, Levi Morrison wrote: >>> On Mon, Aug 22, 2016 at 3:40 PM, Rowan Collins wrote:

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Christoph M. Becker
On 23.08.2016 at 13:36, Julien Pauli wrote: > On Tue, Aug 23, 2016 at 10:30 AM, Christoph M. Becker > wrote: > >> On 23.08.2016 at 00:25, Levi Morrison wrote: >> >>> On Mon, Aug 22, 2016 at 3:40 PM, Rowan Collins >>> wrote: Christoph already linked to this comment in the source

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Julien Pauli
On Tue, Aug 23, 2016 at 10:30 AM, Christoph M. Becker wrote: > On 23.08.2016 at 00:25, Levi Morrison wrote: > >> On Mon, Aug 22, 2016 at 3:40 PM, Rowan Collins >> wrote: >>> >>> Christoph already linked to this comment in the source >>> [https://github.com/php/php-src/blob/PHP-7.0.10/ext/reflec

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Lauri Kenttä
On 2016-08-23 11:30, Christoph M. Becker wrote: On 23.08.2016 at 00:25, Levi Morrison wrote: On Mon, Aug 22, 2016 at 3:40 PM, Rowan Collins wrote: In my opinion, the best "fix", if something needs to change, would be to reject anything other than null; that anything else works appears to jus

Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given

2016-08-23 Thread Christoph M. Becker
On 23.08.2016 at 00:25, Levi Morrison wrote: > On Mon, Aug 22, 2016 at 3:40 PM, Rowan Collins > wrote: >> >> Christoph already linked to this comment in the source >> [https://github.com/php/php-src/blob/PHP-7.0.10/ext/reflection/php_reflection.c#L3197-L3202]: >> >>> /* In case this is a static