Re: BC break: ReflectionMethod::invoke() expects parameter1to be object, string given
| From: | Julien Pauli | Date: | Tue, 23 Aug 2016 13:13:14 +0000 |
| Subject: | Re: BC break: ReflectionMethod::invoke() expects parameter1to be object, string given | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95407@lists.php.net to get a copy of this message | ||
On Tue, Aug 23, 2016 at 3:07 PM, Alexander Lisachenko
<lisachenko.it@gmail.com> wrote:
>
> 2016-08-23 16:01 GMT+03:00 Julien Pauli <jpauli@php.net>:
>>
>> 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::foo() method, but the scope
> (static::class) will be 'B', right? If yes, then everything is ok and it
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.
Julien