Hi, This has been do-able in PHP5 for somewhile, (wrote a reflection browser while ago to show such things) http://www.ren.dotgeek.org/classbrowser/?class=DOMCdataSection
Jared > Here's an idea for the maintainer of the Reflection API, to > be able to view the class a method is defined in (if not overridden). > > > class Vehicle { > function go() {} > function crash() {} > } > > class Car extends Vehicle { > function crash() {} > function collectInsurance() {} > } > > class Ford extends Car { > function fixOrRepairDaily() {} > } > > Reflection::export(new ReflectionClass(Car)); > > > Class [ <user> class Ford extends Car ] { > > - Methods [4] { > Method [ <user> public method fixOrRepairDaily ] { > } > > Method [ <user> public method crash inherited from Car ] { > } > > Method [ <user> public method collectInsurance inherited > from Car ] { > } > > Method [ <user> public method go inherited from Vehicle ] { > } > } > > I am developing on a Windows machine so a Unified Patch isn't > easily attainable (with the tools I have at least). > > Psuedo Patch: > Modify _function_string in zend_reflection_api.c to take a > zend_class_entry of the reflecting class or NULL if not used > in a class context. > Then add the "inherited from" section as below (or however > you'd like to implement). > > string_printf(str, "%s", fptr->common.function_name); if > (fptr->common.scope && memcmp(fptr->common.scope->name, ce->name)) { > string_printf(str, " inherited from %s", > fptr->common.scope->name); } string_printf(str, " ] {\n"); > > > Not sure if this works in all situations, I'll leave that for > you guys to determine if you think this is useful functionality. > > Bob Silva > > -- > PHP Internals - PHP Runtime Development Mailing List To > unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php