1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-03 09:47:59 +01:00
PHP-Parser/test/code/parser/stmt/namespace/mix.test
Nikita Popov caa5c0cc76 Graceful handling for "special" errors
Nearly all special errors are now handled gracefully, i.e. the
parser will be able to continue after encountering them. In some
cases the associated error range has been improved using the new
end attribute stack.

To achieve this the error handling code has been moved out of the
node constructors and into special methods in the parser.
2016-10-09 12:38:18 +02:00

103 lines
1.9 KiB
Plaintext

Namespace types cannot be mixed
-----
<?php
namespace A;
echo 1;
namespace B {
echo 2;
}
echo 3;
-----
Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 4
array(
0: Stmt_Namespace(
name: Name(
parts: array(
0: A
)
)
stmts: array(
0: Stmt_Echo(
exprs: array(
0: Scalar_LNumber(
value: 1
)
)
)
)
)
1: Stmt_Namespace(
name: Name(
parts: array(
0: B
)
)
stmts: array(
0: Stmt_Echo(
exprs: array(
0: Scalar_LNumber(
value: 2
)
)
)
)
)
2: Stmt_Echo(
exprs: array(
0: Scalar_LNumber(
value: 3
)
)
)
)
-----
<?php
namespace A {
echo 1;
}
echo 2;
namespace B;
echo 3;
-----
Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 6
array(
0: Stmt_Namespace(
name: Name(
parts: array(
0: A
)
)
stmts: array(
0: Stmt_Echo(
exprs: array(
0: Scalar_LNumber(
value: 1
)
)
)
)
)
1: Stmt_Echo(
exprs: array(
0: Scalar_LNumber(
value: 2
)
)
)
2: Stmt_Namespace(
name: Name(
parts: array(
0: B
)
)
stmts: array(
0: Stmt_Echo(
exprs: array(
0: Scalar_LNumber(
value: 3
)
)
)
)
)
)