Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20262 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73286 invoked by uid 1010); 23 Nov 2005 11:49:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 73271 invoked from network); 23 Nov 2005 11:49:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2005 11:49:50 -0000 X-Host-Fingerprint: 81.103.221.47 mta07-winn.ispmail.ntl.com Solaris 8 (1) Received: from ([81.103.221.47:8822] helo=mta07-winn.ispmail.ntl.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 8F/10-11378-C5754834 for ; Wed, 23 Nov 2005 06:49:49 -0500 Received: from aamta11-winn.ispmail.ntl.com ([81.103.221.35]) by mta07-winn.ispmail.ntl.com with ESMTP id <20051123114944.TBPU21883.mta07-winn.ispmail.ntl.com@aamta11-winn.ispmail.ntl.com>; Wed, 23 Nov 2005 11:49:44 +0000 Received: from win2ks ([213.107.8.99]) by aamta11-winn.ispmail.ntl.com with ESMTP id <20051123114944.WNXA16192.aamta11-winn.ispmail.ntl.com@win2ks>; Wed, 23 Nov 2005 11:49:44 +0000 Reply-To: To: "'Bob Silva'" , "'internals'" Date: Wed, 23 Nov 2005 11:50:25 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 In-Reply-To: <000001c5efe5$0dcdaf60$5d54edc6@jake> Thread-Index: AcXv5Q3EwHlsCmQPSfCNkd9GRPFA7gAPo6Yg Message-ID: <20051123114944.WNXA16192.aamta11-winn.ispmail.ntl.com@win2ks> Subject: RE: [PHP-DEV] Reflection API idea From: jared.williams1@ntlworld.com ("Jared Williams") References: <000001c5efe5$0dcdaf60$5d54edc6@jake> 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 [ class Ford extends Car ] { > > - Methods [4] { > Method [ public method fixOrRepairDaily ] { > } > > Method [ public method crash inherited from Car ] { > } > > Method [ public method collectInsurance inherited > from Car ] { > } > > Method [ 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 >