Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20260 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89728 invoked by uid 1010); 23 Nov 2005 08:40:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 89713 invoked from network); 23 Nov 2005 08:40:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2005 08:40:49 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:41553] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 78/37-11378-01B24834 for ; Wed, 23 Nov 2005 03:40:48 -0500 Received: from [192.168.1.3] (dslb-084-063-025-117.pools.arcor-ip.net [84.63.25.117]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id DC2F9610284; Wed, 23 Nov 2005 09:46:39 +0100 (CET) Date: Wed, 23 Nov 2005 09:39:23 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <210203901.20051123093923@marcus-boerger.de> To: Bob Silva Cc: 'internals' In-Reply-To: <000001c5efe5$0dcdaf60$5d54edc6@jake> References: <000001c5efe5$0dcdaf60$5d54edc6@jake> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Reflection API idea From: helly@php.net (Marcus Boerger) Hello Bob, have you looked at head output of Reflection lately? I guess that contains all you want, right? marcus Wednesday, November 23, 2005, 5:19:10 AM, you wrote: > 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 Best regards, Marcus