Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20275 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49501 invoked by uid 1010); 23 Nov 2005 20:14:46 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 49486 invoked from network); 23 Nov 2005 20:14:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2005 20:14:46 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:43156] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 56/24-11378-5BDC4834 for ; Wed, 23 Nov 2005 15:14:45 -0500 Received: from [192.168.1.3] (dslb-084-063-014-014.pools.arcor-ip.net [84.63.14.14]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id A8F48610284; Wed, 23 Nov 2005 21:20:42 +0100 (CET) Date: Wed, 23 Nov 2005 21:12:39 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1728502150.20051123211239@marcus-boerger.de> To: Jared Williams Cc: 'Bob Silva' , 'internals' In-Reply-To: <20051123114944.WNXA16192.aamta11-winn.ispmail.ntl.com@win2ks> References: <000001c5efe5$0dcdaf60$5d54edc6@jake> <20051123114944.WNXA16192.aamta11-winn.ispmail.ntl.com@win2ks> 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 Jared, hey cool stuff! Any chance you could publish this or make it a PEAR class or put it into the newly created Reflection extension as example? best regards marcus Wednesday, November 23, 2005, 12:50:25 PM, you wrote: > 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 >> Best regards, Marcus