Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20257 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84376 invoked by uid 1010); 23 Nov 2005 04:17:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 84361 invoked from network); 23 Nov 2005 04:17:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2005 04:17:16 -0000 X-Host-Fingerprint: 198.237.84.92 unknown Linux 2.4/2.6 Received: from ([198.237.84.92:1664] helo=bobsilva.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 1F/1C-11378-B4DE3834 for ; Tue, 22 Nov 2005 23:17:16 -0500 Received: from [198.237.84.93] (HELO jake) by bobsilva.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 681798 for internals@lists.php.net; Tue, 22 Nov 2005 16:56:49 -0800 To: "'internals'" Date: Tue, 22 Nov 2005 20:19:10 -0800 Message-ID: <000001c5efe5$0dcdaf60$5d54edc6@jake> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcXv5Q3EwHlsCmQPSfCNkd9GRPFA7g== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 Subject: Reflection API idea From: me@bobsilva.com ("Bob Silva") 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