Re: [RFC] ReflectionParameter::hasTypehint() / getTypehintText()
| From: | Adam Harvey | Date: | Fri, 30 May 2014 05:06:03 +0000 |
| Subject: | Re: [RFC] ReflectionParameter::hasTypehint() / getTypehintText() | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74651@lists.php.net to get a copy of this message | ||
On 29 May 2014 18:08, Levi Morrison <levim@php.net> wrote:
> On Thu, May 29, 2014 at 4:54 PM, Derick Rethans <derick@php.net> wrote:
>> I don't think it should return an empty string when hasTypehint has
>> failed (the 4th "test") in your test case (for $d). IMO, it should
>> return NULL.
>
> If it doesn't have type information I think an empty string should be
> returned. Since you can't have an empty type hint there really isn't a
> conflict there. This means the function can always return a string.
I'd prefer NULL to indicate the complete absence of a type hint too —
it ends up as an empty string if it's used in that context regardless,
but the changed type is useful. I don't feel strongly enough about
this that it would affect my vote, though.
> That's my $0.02.
Adam, providing 2.17 Canadian cents.