php-parser/test/code/parser/stmt/namespace/outsideStmt.test-fail
nikic 1f143393e5 Rewrite namespace handling code
Add a check for disallowed statements between braced namespaces
while at it.
2014-04-21 15:16:00 +02:00

20 lines
397 B
Plaintext

There (mostly) can't be statements outside of namespaces
-----
<?php
echo 1;
namespace A;
-----
Namespace declaration statement has to be the very first statement in the script on line 3
-----
<?php
namespace A {}
echo 1;
-----
No code may exist outside of namespace {} on line 3
-----
<?php
namespace A {}
declare(ticks=1);
namespace B {}
-----
No code may exist outside of namespace {} on line 3