Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20258 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77503 invoked by uid 1010); 23 Nov 2005 07:56:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 77488 invoked from network); 23 Nov 2005 07:56:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2005 07:56:53 -0000 X-Host-Fingerprint: 198.237.84.92 unknown Linux 2.4/2.6 Received: from ([198.237.84.92:1666] helo=bobsilva.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 93/46-11378-5C024834 for ; Wed, 23 Nov 2005 02:56:53 -0500 Received: from [198.237.84.93] (HELO jake) by bobsilva.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 681836 for internals@lists.php.net; Tue, 22 Nov 2005 20:36:28 -0800 To: "'internals'" Date: Tue, 22 Nov 2005 23:58:48 -0800 Message-ID: <000101c5f003$bc691aa0$5d54edc6@jake> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <000001c5efe5$0dcdaf60$5d54edc6@jake> Thread-Index: AcXv5Q3EwHlsCmQPSfCNkd9GRPFA7gAHpFbg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 Subject: RE: [PHP-DEV] Reflection API idea From: me@bobsilva.com ("Bob Silva") References: <000001c5efe5$0dcdaf60$5d54edc6@jake> Whoops, that memcmp should be a strcmp. > -----Original Message----- > From: Bob Silva [mailto:me@bobsilva.com] > Sent: Tuesday, November 22, 2005 8:19 PM > To: 'internals' > Subject: [PHP-DEV] Reflection API idea > > 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