Re: Re: [RFC][Vote] ReflectionType Improvements

From: Date: Sat, 09 Jul 2016 15:12:44 +0000
Subject: Re: Re: [RFC][Vote] ReflectionType Improvements
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-94454@lists.php.net to get a copy of this message
On Sat, Jul 9, 2016 at 8:16 AM, Aaron Piotrowski <aaron@trowski.com> wrote: >> >> 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. 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?

« previous php.internals (#94454) next »