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

>
> > On Aug 17, 2016, at 11:45 AM, Marco Pivetta <ocram...@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 `\` 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.
>

Aware.


> 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.
>

This is something to be fixed by introducing support for PHP 7.1 from our
(doctrine/zendframework) side, not from PHP's side by changing existing
behavior (very very very messy).
Doctrine does not yet deal with 7.1, although work started on it, and I'll
likely complete it once we get at last RC phases of 7.1:
https://github.com/doctrine/common/pull/734/files


> Unfortunately I think no matter what is done, nullable types just created
> another headache for you. :-(
>

That would have been a headache anyway. We saw it coming, and it will be
fixed on our end, but please don't try to outsmart it.
I know that there is good intention on your side, but this is really going
to just make it an issue.

>From the codegen-side (I do write a lot of code generators), having `\`
prepended in front of stuff makes things just more complex to deal with,
since I have to strip it and re-introduce it anyway in multiple locations
in the code, while it should just be attached in the final output-logic bit.
Instead, please keep the reflector on-spot: reflecting things, telling us
what they are. What the code generator does with the definitions is up to
the code generator after that.

We have to adjust the code for `void` and `?` anyway, so this is just more
changes to keep track of, and it would break existing code.

P.S.: a lot of confusion between direct/mailing-list responses. Sorry if
this comes through as a new thread, that's not intentional.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

Reply via email to