On Sat, Jul 9, 2016 at 8:16 AM, Aaron Piotrowski <aa...@trowski.com> wrote:
>>
>> On Jul 9, 2016, at 8:17 AM, Levi Morrison <le...@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.

This wasn't an oversight. If we add union or intersection types then
not all types are named (for instance `ArrayAccess & Countable &
Traversable` is not a named type). This is why it doesn't exist on the
base ReflectionType.

I have surveyed some of the people who have voted no. Their reasons
vary but based on these conversations it seems to me that by dropping
ReflectionClassType and the associated autoloading mechanism that
overall we'd be happier. I do agree with Aaron that at least *some*
changes really need to go into 7.1. How do people feel about my
proposal to just drop autoloading and `ReflectionClassType`?

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to