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->invoke(new DateTime);

...make any more sense than this?

$a = new reflectionMethod('A', 'foo');
$a->invoke(42);


If you want to allow an object to be passed in, it should act the same way as a string - specify the binding context:

$a = new reflectionMethod('A', 'foo');
$a->invoke(new B); // equivalent to $a->invoke('B');

It should also go through the same check as it would for a non-static method: must be an instance of the class being reflected.

Regards,
--
Rowan Collins
[IMSoP]

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

Reply via email to