Re: ReflectionType::__toString() prepending \ to class names
| From: | Aaron Piotrowski | Date: | Wed, 17 Aug 2016 16:55:20 +0000 |
| Subject: | Re: ReflectionType::__toString() prepending \ to class names | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95267@lists.php.net to get a copy of this message | ||
> On Aug 17, 2016, at 11:45 AM, Marco Pivetta <ocramius@gmail.com> wrote:
>
> Since scalar types are invalid anyway if prepended with
\, I
> see no point
> in producing a string with the \ in it.
>
> The current consumers of Type assume no hiµäõjÚ
> ÀªP¸þ\ is prepended, and we spent an
> age and a half dealing with \ being in front of class names in
> doctrine
> (and finally got rid of it).
>
> This is not being really helpful, as it is.
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>
Scalar types do not have a \ prepended. Only class, interface, and trait names.
Can you show me some of the code in Doctrine that handles this? This issue came up because of
Doctrine prepending a \ in front of nullable class names [1], resulting in \?Type,
which of course is invalid.
Unfortunately I think no matter what is done, nullable types just created another headache for you.
:-(
Aaron Piotrowski
[1] https://github.com/php/php-src/pull/2068#issuecomment-239983716
(Forgot to CC internals again... ugh)