Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81492 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41753 invoked from network); 31 Jan 2015 17:31:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2015 17:31:53 -0000 Authentication-Results: pb1.pair.com header.from=pjsturgeon@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pjsturgeon@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.46 as permitted sender) X-PHP-List-Original-Sender: pjsturgeon@gmail.com X-Host-Fingerprint: 209.85.215.46 mail-la0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:33362] helo=mail-la0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/10-39884-7811DC45 for ; Sat, 31 Jan 2015 12:31:52 -0500 Received: by mail-la0-f46.google.com with SMTP id s18so29985829lam.5 for ; Sat, 31 Jan 2015 09:31:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=olZXc9PLVrIPdVesh3mfIeEzstvFKOrp1kKABXLTuB4=; b=gUMyMD6PKx+yMLpnutRJRq1dqOwHn1oZlwcjHEVOjpvOQaGYtTTGZHxN9x95ZNxbQy IEtIn3yQpJsjCpVvt0ik2DrIa5IhPSWl5i1O5SRBBokV+sZZEZ/DSKzBrWLMoJ0+r54I FLO+JNcQ1pjYvG16He4EZFfCP+uM1T30ALCJTIUuLOehROXamSLCXr86eAxGBHW2c4lJ H2JCV955Ka/whALAwcdqs/2ocZIKxpZAU2mTjvcv3OAhJTLNkzWEi/Lbvj9adluYNef/ MTruXpNf4VuBwSKwlUhFNVSBzrqrg+TATKMJjxu/C7Tk4aWdeMKMlnrfSQWyaiHHRRUu zKcA== MIME-Version: 1.0 X-Received: by 10.112.125.4 with SMTP id mm4mr11719711lbb.86.1422725508443; Sat, 31 Jan 2015 09:31:48 -0800 (PST) Received: by 10.114.60.204 with HTTP; Sat, 31 Jan 2015 09:31:48 -0800 (PST) In-Reply-To: <54CC8E81.3020104@beccati.com> References: <54CC8E81.3020104@beccati.com> Date: Sat, 31 Jan 2015 12:31:48 -0500 Message-ID: To: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC][DISCUSSION] ReflectionParameter::getClassName() From: pjsturgeon@gmail.com (Philip Sturgeon) On Sat, Jan 31, 2015 at 3:12 AM, Matteo Beccati wrote: > Hi Phil, > > > On 31/01/2015 05:14, Philip Sturgeon wrote: >> >> This RFC adds a new method to ReflectionParameter to allow easy access >> to a class name in a type hint, avoiding the need to actually load the >> class and use `get_class()` or `::class`. >> >> https://wiki.php.net/rfc/reflectionparameter-getclassname > > > Looks good to me! > > Just a couple of minor things. > > 1) The RFC does not mention what happens if the parameter is not type > hinted, or what happens when hints are namespaced and/or use clauses are > used. > > 2) There's a tiny bit of overlap with "scalar type hints", if it is accepted > (in any form) and reflection support added to it. Depending on the way such > reflection support is implemented, the method proposed here could be a > perfect match. Or perhaps it could be in the way. > > > Cheers > -- > Matteo Beccati > > Development & Consulting - http://www.beccati.com/ Thanks! Good questions. 1) Thanks for your help on GitHub in making tests for this. Implemented nicely. 2) There might be some overlap in the scalar type hint stuff kinda, but I'd like to think there isn't. getClassName() is just getClass()->name without loading the actual class. Getting "string' or "int" back is likely to have its own logic in the scalar type hint RFC so I'd rather stay clear of it altogether.