Re: Does ReflectionMethod::setAccessible() do anything?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 16, 2010 at 6:09 PM, Nathan Nobbe <quickshiftin@xxxxxxxxx>wrote:

> you just have to invoke the function from the context of the
> ReflectionMethod instance
>
> <?php
> class Foo { protected function bar() { echo "foobar\n"; } }
> $m = new ReflectionMethod('Foo', 'bar');
> $m->setAccessible(true);
> $m->invokeArgs(new Foo(), array());
> ?>
>

Thank you, Nathan. That makes perfect sense and would be a good addition to
the documentation page for setAccessible(). Even better, I may even be able
to make use of it in my testing framework since I only want the method to be
exposed for one call from the test method.

David

--
David Harkness
Senior Software Engineer
High Gear Media

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux