Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74646 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26490 invoked from network); 29 May 2014 22:01:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 May 2014 22:01:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.160.46 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.160.46 mail-pb0-f46.google.com Received: from [209.85.160.46] ([209.85.160.46:56788] helo=mail-pb0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/B3-07154-B2EA7835 for ; Thu, 29 May 2014 18:01:16 -0400 Received: by mail-pb0-f46.google.com with SMTP id rq2so958948pbb.5 for ; Thu, 29 May 2014 15:01:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=q5PmHFDs7zj75JD6Ajw7ML/aCcQo7wskE2lEArvdsQs=; b=IM3tFMmsKssO19tAXb7z8yNAFg8YKeqRHTh4wYiEzCXb4QsfqxbE844whPoWMTT3OZ VZjOClSmvE744pov2pK0KH1z6qSAWApa035VnAI+w5jNIcI2Mhk12r8SfYwP5eB7yt0n 3s/I/mWag24OiYR9ppc5Yr1kFOGmx1I49g0EMrl379Te7PK0LfkCa3O6pHTQ65bUuY4s 9qrtzKkx4id+z93uqwCn21Y/v9CVWeqHrvRmhafzL2H9MgMlDk86lfn8GnSsPSvLpxvs +68yr7cYTHJBwepvaIso4zK69Igjodkn6CGSfPC+zwuuxYaMxSstQQtlxvFbE6PhWzWn ECPw== X-Gm-Message-State: ALoCoQlDQmJsrNa0i87U2TpIFwPv+hBCn/HEKsaS2ZznZNKJwdWiv0WzNzvCs054OFmjMMe2T1Qc MIME-Version: 1.0 X-Received: by 10.68.164.100 with SMTP id yp4mr12542041pbb.136.1401400872484; Thu, 29 May 2014 15:01:12 -0700 (PDT) Sender: php@golemon.com Received: by 10.70.100.67 with HTTP; Thu, 29 May 2014 15:01:12 -0700 (PDT) X-Originating-IP: [2620:0:1cfe:18:22c9:d0ff:fe87:295b] In-Reply-To: References: Date: Thu, 29 May 2014 15:01:12 -0700 X-Google-Sender-Auth: T9FJ-rFs5kGizVJkKLOTLFPYhzY Message-ID: To: Levi Morrison Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] ReflectionParameter::hasTypehint() / getTypehintText() From: pollita@php.net (Sara Golemon) On Thu, May 29, 2014 at 1:55 PM, Levi Morrison wrote: > On Thu, May 29, 2014 at 1:59 PM, Sara Golemon wrote: >> Pretty straight-forward. Makes it easier to recreate a function >> signature from PHP (Mocking) >> https://wiki.php.net/rfc/reflectionparameter.typehint > > I'm hoping to improve the way types are handled in reflection but I've > been waiting until the return types and nullable types RFCs have been > voted on as that will most likely impact my decisions. I'd like to > introduce getType and hasType functions that holds various bits of > information such as isArray(), isCallable() and could also contain the > text representation of the type. What are your thoughts on that? > As in something like this? $rf = new ReflectionFunction('foo'); list($rp) = $rf->getParameters(); $hint = $rp->getType(); // returns ReflectionTypeHint if ($hint->isArray()) { ... } I thought about that (and would like to see it), which is why I specifically went for the name getTypehintText(), which leaves the "get me an object version" (i.e. getTypehint()) left available. See also: https://wiki.php.net/rfc/reflectionparameter.typehint#on_the_naming If you think it's a bit too busy to have getTypehint(): object, and getTypehintText(): string, I can hold off on this RFC for awhile. There's certainly no rush. Or did you mean something else? -Sara