add fn_flags to getMethod() result (reflection)

php.internals

Pierre-Alain Joye

22 years ago
Hello, Regarding the question about how to know if a method is declared static or not, I add the fn_flags to the result (flags property) of getMethod();. I tested it with PHP userland classes but not internal objects. This new property reflects the internal fn_flags in zend_function struct. The constants required are already available so it's easy to get the method type. If I missed some other reflection methods which already provide this info, please point me to them :) hth pierre

Marcus Börger

22 years ago
Hello Pierre-Alain, Thursday, February 19, 2004, 3:51:41 PM, you wrote:
> Hello,
> Regarding the question about how to know if a method is declared static > or not, I add the fn_flags to the result (flags property) of > getMethod();. I tested it with PHP userland classes but not internal > objects. This new property reflects the internal fn_flags in > zend_function struct. The constants required are already available so > it's easy to get the method type.
> If I missed some other reflection methods which already provide this > info, please point me to them :)
here you go: php -r '$m = new reflection_method("reflection_method","export"); var_dump($m->isStatic());'
-- Best regards, Marcus mailto:helly@php.net