Re: Re: [RFC][Vote] ReflectionType Improvements
| From: | Aaron Piotrowski | Date: | Sat, 09 Jul 2016 14:16:35 +0000 |
| Subject: | Re: Re: [RFC][Vote] ReflectionType Improvements | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94452@lists.php.net to get a copy of this message | ||
>
> On Jul 9, 2016, at 8:17 AM, Levi Morrison <levim@php.net> wrote:
>>
>
> The final vote was 5 in favor and 8 against. This RFC has been rejected.
>
While this RFC was rejected, ReflectionType::__toString() should still be updated to include a ? for
nullable types. This is a consequence of the nullable types RFC. As mentioned in this RFC [1], the
string representation of ReflectionType should be a syntax-valid representation of the type. Without
adding ?, this will no longer be true. I do not view this as a BC break. In fact, it is a BC break
for PHPUnit, PHPSpec, and Mockery to not make this change, as they currently depend on the string
representation of ReflectionType to generate code compatible with the parent class or interface.
Additionally, I propose adding a getName() method to ReflectionType that returns only the name of
the type, regardless of nullability. Casting should not be required to get information from an
object, but currently this is the only way to get the type name from ReflectionType. Most other
reflection classes include a getName() method, this seems to have been an oversight.
Joe and Davey, what are your thoughts on this?
Aaron Piotrowski
[1] https://wiki.php.net/rfc/reflectiontypeimprovements#backward_incompatible_changes