On Tue, Nov 24, 2015 at 8:10 AM, Sebastian Bergmann <[email protected]>
wrote:
> The following is currently valid PHP 7 code
>
> <?php
> function a(\int $i) {}
>
> Is it intentional that the \ in front of the "int" is allowed? IMHO, this
> confusing notation must not be allowed.
>
>
> Why not? Its a root level type, you can prefix a \ on any other root level
type that's valid for use in type hinting.
function a(\DateTime $d) {}
function b(\SplFileObject $f) {}
Also, this is the only way to get some IDEs to recognize the type when in a
namespace (at least currently).