> On Tue, Nov 24, 2015 at 8:10 AM, Sebastian Bergmann <sebast...@php.net>
> 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).

The difference is that DateTime and \DateTime mean different things inside a 
namespace. int and \int always mean the same thing, so it seems confusing to 
allow the latter syntax as if it means something different.
                                          
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to