Marco,

> On Aug 17, 2016, at 11:22 AM, Marco Pivetta <ocram...@gmail.com 
> <mailto:ocram...@gmail.com>> wrote:
> 
> 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://twitter.com/Ocramius>      
> 
> http://ocramius.github.com/ <http://ocramius.github.com/>
> 


Adjustments will be necessary in Zend\Code no matter what because of nullable 
types. If a type is nullable, ReflectionType::__toString() will return 
"?\Type\Name" or without the changes I committed it would return "?Type\Name".

If you need the type name without the leading ? or \, use 
ReflectionNamedType::getName().

It would be nice to have no BC breaks, but right now I'm not seeing a way of 
handling nullable types in ReflectionType::__toString() without some sort of BC 
break.

Aaron Piotrowski

Reply via email to