Chris,

I'll edit in the proposal, but you can check the tests in the mean time:

https://github.com/ircmaxell/php-src/blob/c8590799622ddb801360664d08ac5d7f4fa342df/Zend/tests/typehints/scalar_strict_declaration_placement_002.phpt
https://github.com/ircmaxell/php-src/blob/c8590799622ddb801360664d08ac5d7f4fa342df/Zend/tests/typehints/scalar_strict_declaration_placement_004.phpt
https://github.com/ircmaxell/php-src/blob/c8590799622ddb801360664d08ac5d7f4fa342df/Zend/tests/typehints/scalar_strict_declaration_placement_005.phpt

So it needs to come before the namespace declaration (in fact, it
currently needs to be the first declaration in the file).

Though I am about to implement the block syntax, and that may alter
things slightly (though declare will be required to be outside the
namespace).

Anthony


On Fri, Feb 20, 2015 at 6:07 AM, Chris Harvey <ch...@chrisnharvey.com> wrote:
> Hi Anthony,
>
> I have been interested in this proposal for a while now. I'm not on 
> internals, but I have a question about your proposal.
>
>> 1. declare(strict_types=1) (if used) is required to be the first
>> instruction in the file only. No other usages allowed.
>
> How would this work with namespaces?
>
> declare(strict_types=1) namespace Foo;
>
> namespace Bar; declare(strict_types=1)
>
> strict namespace Baz;
>
> Really good proposal though. Really hope it passes vote and we finally get 
> scalar type hints in PHP.
>
> Cheers,
>
> Chris

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to