Sorry, I have to object here: this is quite a BC break for Zend\Code,
specifically. We will have to re-adjust the code generators to adapt to the
newly introduced prepended `\`.

In addition to that, there is no need for `\` to be prepended to a type
string, since inside string scope, we are always dealing with the base
namespace.

Seems unnecessary and causes a lot of headaches, instead of actually
simplifying things.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On Wed, Aug 17, 2016 at 6:18 PM, Aaron Piotrowski <aa...@trowski.com> wrote:

> Hi all,
>
> I recently made some changes [1] to ReflectionType::__toString() that
> prepends a leading \ to class names. These changes follow from the
> discussion on ReflectionType improvements [2, 3] and the discussion on my
> PR to implement some of the RFC [4].
>
> A \ should be prepended to class names returned from
> ReflectionType::__toString() so the output of this method can be used when
> generating code within a namespace. Currently, several libs such as
> Doctrine manually prepend a \ when generating code. Nullable types will
> complicate this, since a ? is prepended to the type name, requiring a \ to
> instead be inserted as the second character. The changes I made will
> alleviate the need for libs to manipulate the string returned from
> ReflectionType::__toString() when generating code. This will become more
> important if more complex types are introduced, such as callable prototypes.
>
> If anyone has objections to these changes, please let me know.
>
> Thanks!
>
> Aaron Piotrowski
>
> [1] http://git.php.net/?p=php-src.git;a=commitdiff;h=
> 20fdd47921f423728b409fd0ae0106dab9c34573
> [2] http://news.php.net/php.internals/94452
> [3] https://wiki.php.net/rfc/reflectiontypeimprovements
> [4] https://github.com/php/php-src/pull/2068#issuecomment-240071841
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to