Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74647 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28459 invoked from network); 29 May 2014 22:22:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 May 2014 22:22:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.182 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.214.182 mail-ob0-f182.google.com Received: from [209.85.214.182] ([209.85.214.182:45816] helo=mail-ob0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/14-07154-833B7835 for ; Thu, 29 May 2014 18:22:48 -0400 Received: by mail-ob0-f182.google.com with SMTP id wn1so1006685obc.13 for ; Thu, 29 May 2014 15:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=gh45MfI9eZj1BImDKonhRjlTrcVm3O66MQ5CJsj5onU=; b=eXKFaYztWXkkW67i7IoXZ1uXTsmWNSNvSlOC1VTWmtl3WdiDqR09IYmv5gz2zuf5YZ NvDFCehfXZkRFAxH2L64rO5ujs9yzS5gaKd4YI+39qxvknCh0byML5sDGNmZIEvAcX3J Q+IfftskzLbfWlDYkZr56oblhG+DPbEfRinncJpLHkayHHsq3iFfSXz2MYdW4lfCFxfR G7kPZBqz1BcQtHxdlHlrFIvfHx9o4V1Ce/EZ2HjN7cVfcToQdkXFoGJJTSbig5VhFPwZ Mrf4Iw/7vHeBeYTeJpxOwNGHcxcBxDZiSyZAo1WS1lL2KrqvVpHjuABtRu/AFufs8KpT pwqg== MIME-Version: 1.0 X-Received: by 10.60.159.234 with SMTP id xf10mr12482482oeb.15.1401402165710; Thu, 29 May 2014 15:22:45 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.76.77.100 with HTTP; Thu, 29 May 2014 15:22:45 -0700 (PDT) In-Reply-To: References: Date: Thu, 29 May 2014 16:22:45 -0600 X-Google-Sender-Auth: 04dXpkbbzzC5nXvEWvDDFKiTMhk Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] ReflectionParameter::hasTypehint() / getTypehintText() From: levim@php.net (Levi Morrison) On Thu, May 29, 2014 at 4:01 PM, Sara Golemon wrote: > 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. Yeah, I mean something like that. Maybe we could collaborate in IRC somewhere to work out details? We can move much faster that way. I'm regularly in #hhvm on freenode and #php.doc and #php.pecl on efnet as LeviM or LeviM_t.