Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56899 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88854 invoked from network); 13 Dec 2011 01:11:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2011 01:11:00 -0000 Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:52892] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/22-06964-326A6EE4 for ; Mon, 12 Dec 2011 20:10:59 -0500 Received: by ggnv1 with SMTP id v1so6750448ggn.29 for ; Mon, 12 Dec 2011 17:10:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=OE86iV5C5saNS50jB8uAU9SWm2FVslMuIblgMVdj4to=; b=ncTw4dyS9XiIwIHTxUOhD44Z8qMom1IhsmbT/OlCudHo1VNEsX6JcGEL4vpraOvQpx ZPPNNpf8ouPGsvi7XnwoPBW6cVxDYlssnfn4mlfB50k3N4W/VD4161zMLEqNUKzW7m/c 5FYT0hkUrnH+L+5ZA+U4ib+J0xtO2btprGsag= Received: by 10.182.192.103 with SMTP id hf7mr3565505obc.29.1323738656227; Mon, 12 Dec 2011 17:10:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.2.228 with HTTP; Mon, 12 Dec 2011 17:10:35 -0800 (PST) In-Reply-To: <1323737529.5219.36.camel@guybrush> References: <9570D903A3BECE4092E924C2985CE485399554D7@MBX202.domain.local> <7070130643313812382@unknownmsgid> <9570D903A3BECE4092E924C2985CE4853995589C@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE48539955910@MBX202.domain.local> <9570D903A3BECE4092E924C2985CE4853995598C@MBX202.domain.local> <1323737529.5219.36.camel@guybrush> Date: Mon, 12 Dec 2011 20:10:35 -0500 Message-ID: To: =?UTF-8?Q?Johannes_Schl=C3=BCter?= Cc: Clint M Priest , Pierre Joye , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Accessors v2 Patch From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") Hi, I don't see how we could possibly do as option 1. The structure would be weird, because considering I'm looking for an specific ReflectionMethod that matches a property name, I'd also be able to call it through invoke, but also regularly through $obj->Setter($value); Since I don't see in the match as possible to be executed as the second possibility, I'd rather bring to a more centralized approach. $reflProperty =3D $reflClass->getProperty('Hours'); $reflProperty->hasGetter() =3D=3D=3D true $reflProperty->hasSetter() =3D=3D=3D true Also, $reflProperty->setValue($object, $value); would call the Setter method as well as $reflProperty->getValue($object) would call the Getter method It seems the most consistent and centralized approach. Regards, 2011/12/12 Johannes Schl=C3=BCter : > On Mon, 2011-12-12 at 01:01 +0000, Clint M Priest wrote: >> To be complete I should probably add something to the reflection system = as well. =C2=A0At present the getters/setters would show up as functions. >> >> What would be preferable? >> 1) Show up as regular functions and let users fend for themselves? >> 2) Hide from getMethods() and: >> =C2=A0 2.1) Provide getAccessors() - Probably returning a new Reflection= PropertyAccessor class? >> =C2=A0 2.2) Provide getGetters(), getSetters() >> 3) Modify ReflectionProperty to include hasGetter() and hasSetter() >> >> Comments? > > Reflection in PHP typically is leaking the implementation details > typically quite a lot instead of abstracting things away (interfaces and > Traits are ReflectionClass instances etc.) > > I didn't look at the implementation but if these accessors are > implemented as methods (especially if it can be called just like one) I > would go for approach 1) and probably mark with a flag. For everything > else we'd probably have to clean-u reflection to leak less details to > make sense. > > johannes > >> -----Original Message----- >> From: Pierre Joye [mailto:pierre.php@gmail.com] >> Sent: Sunday, December 11, 2011 6:47 PM >> To: Clint M Priest >> Cc: internals@lists.php.net >> Subject: Re: [PHP-DEV] Accessors v2 Patch >> >> oh right, I missed them. Yes, so it is covered as well :) >> >> On Mon, Dec 12, 2011 at 1:42 AM, Clint M Priest wr= ote: >> > There are already two tests against private read and private write, sh= ould I add two for protected as well? >> >> Cheers, >> -- >> Pierre >> >> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org >> > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --=20 Guilherme Blanco MSN: guilhermeblanco@hotmail.com GTalk: guilhermeblanco Toronto - ON/Canada