First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
168
vendor/nikic/php-parser/test/code/parser/stmt/namespace/alias.test
vendored
Normal file
168
vendor/nikic/php-parser/test/code/parser/stmt/namespace/alias.test
vendored
Normal file
|
@ -0,0 +1,168 @@
|
|||
Aliases (use)
|
||||
-----
|
||||
<?php
|
||||
|
||||
use A\B;
|
||||
use C\D as E;
|
||||
use F\G as H, J;
|
||||
|
||||
// evil alias notation - Do Not Use!
|
||||
use \A;
|
||||
use \A as B;
|
||||
|
||||
// function and constant aliases
|
||||
use function foo\bar;
|
||||
use function foo\bar as baz;
|
||||
use const foo\BAR;
|
||||
use const foo\BAR as BAZ;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
1: D
|
||||
)
|
||||
)
|
||||
alias: E
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: F
|
||||
1: G
|
||||
)
|
||||
)
|
||||
alias: H
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: J
|
||||
)
|
||||
)
|
||||
alias: J
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
alias: A
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // evil alias notation - Do Not Use!
|
||||
)
|
||||
)
|
||||
4: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Use(
|
||||
type: TYPE_FUNCTION (2)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: bar
|
||||
)
|
||||
)
|
||||
alias: bar
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // function and constant aliases
|
||||
)
|
||||
)
|
||||
6: Stmt_Use(
|
||||
type: TYPE_FUNCTION (2)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: bar
|
||||
)
|
||||
)
|
||||
alias: baz
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Stmt_Use(
|
||||
type: TYPE_CONSTANT (3)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: BAR
|
||||
)
|
||||
)
|
||||
alias: BAR
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Stmt_Use(
|
||||
type: TYPE_CONSTANT (3)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: BAR
|
||||
)
|
||||
)
|
||||
alias: BAZ
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
42
vendor/nikic/php-parser/test/code/parser/stmt/namespace/braced.test
vendored
Normal file
42
vendor/nikic/php-parser/test/code/parser/stmt/namespace/braced.test
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
Braced namespaces
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar {
|
||||
foo;
|
||||
}
|
||||
namespace {
|
||||
bar;
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
1: Bar
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: null
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
22
vendor/nikic/php-parser/test/code/parser/stmt/namespace/commentAfterNamespace.test
vendored
Normal file
22
vendor/nikic/php-parser/test/code/parser/stmt/namespace/commentAfterNamespace.test
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Trailing comment after braced namespace declaration
|
||||
-----
|
||||
<?php
|
||||
namespace Foo {}
|
||||
// Comment
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // Comment
|
||||
)
|
||||
)
|
||||
)
|
188
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUse.test
vendored
Normal file
188
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUse.test
vendored
Normal file
|
@ -0,0 +1,188 @@
|
|||
Group use declarations
|
||||
-----
|
||||
<?php
|
||||
use A\{B};
|
||||
use A\{B\C, D};
|
||||
use \A\B\{C\D, E};
|
||||
use function A\{b\c, d};
|
||||
use const \A\{B\C, D};
|
||||
use A\B\{C\D, function b\c, const D};
|
||||
-----
|
||||
array(
|
||||
0: Stmt_GroupUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_GroupUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
1: C
|
||||
)
|
||||
)
|
||||
alias: C
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_GroupUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
1: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
alias: E
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_GroupUse(
|
||||
type: TYPE_FUNCTION (2)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: b
|
||||
1: c
|
||||
)
|
||||
)
|
||||
alias: c
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: d
|
||||
)
|
||||
)
|
||||
alias: d
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_GroupUse(
|
||||
type: TYPE_CONSTANT (3)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
1: C
|
||||
)
|
||||
)
|
||||
alias: C
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_GroupUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
1: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: TYPE_FUNCTION (2)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: b
|
||||
1: c
|
||||
)
|
||||
)
|
||||
alias: c
|
||||
)
|
||||
2: Stmt_UseUse(
|
||||
type: TYPE_CONSTANT (3)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
107
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUseErrors.test
vendored
Normal file
107
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUseErrors.test
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
Invalid group use syntax
|
||||
-----
|
||||
<?php
|
||||
// Missing semicolon
|
||||
use Foo\{Bar}
|
||||
use Bar\{Foo};
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected T_USE, expecting ';' from 4:1 to 4:3
|
||||
array(
|
||||
0: Stmt_GroupUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
alias: Bar
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // Missing semicolon
|
||||
)
|
||||
)
|
||||
1: Stmt_GroupUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
alias: Foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
// Missing NS separator
|
||||
use Foo {Bar, Baz};
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected '{', expecting ';' from 3:9 to 3:9
|
||||
array(
|
||||
0: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
alias: Foo
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // Missing NS separator
|
||||
)
|
||||
)
|
||||
1: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Baz
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
// Extra NS separator
|
||||
use Foo\{\Bar};
|
||||
-----
|
||||
Syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING or T_FUNCTION or T_CONST from 3:10 to 3:10
|
||||
array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
28
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUsePositions.test
vendored
Normal file
28
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUsePositions.test
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
Ensure correct file position attributes for group use prefix
|
||||
-----
|
||||
<?php
|
||||
use Foo\Bar\{Baz};
|
||||
-----
|
||||
!!positions
|
||||
array(
|
||||
0: Stmt_GroupUse[2:1 - 2:17](
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name[2:5 - 2:11](
|
||||
parts: array(
|
||||
0: Foo
|
||||
1: Bar
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse[2:14 - 2:16](
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name[2:14 - 2:16](
|
||||
parts: array(
|
||||
0: Baz
|
||||
)
|
||||
)
|
||||
alias: Baz
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
47
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUseTrailingComma.test
vendored
Normal file
47
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUseTrailingComma.test
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
Group use can have trailing comma
|
||||
-----
|
||||
<?php
|
||||
use A\{B,};
|
||||
use function A\{b,};
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_GroupUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_GroupUse(
|
||||
type: TYPE_FUNCTION (2)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: b
|
||||
)
|
||||
)
|
||||
alias: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
83
vendor/nikic/php-parser/test/code/parser/stmt/namespace/invalidName.test
vendored
Normal file
83
vendor/nikic/php-parser/test/code/parser/stmt/namespace/invalidName.test
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
Invalid namespace names
|
||||
-----
|
||||
<?php namespace self;
|
||||
-----
|
||||
Cannot use 'self' as namespace name from 1:17 to 1:20
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: self
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php namespace PARENT;
|
||||
-----
|
||||
Cannot use 'PARENT' as namespace name from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: PARENT
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php namespace static;
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING or T_NS_SEPARATOR or '{' from 1:17 to 1:22
|
||||
array(
|
||||
)
|
||||
-----
|
||||
<?php use A as self;
|
||||
-----
|
||||
Cannot use A as self because 'self' is a special class name from 1:16 to 1:19
|
||||
array(
|
||||
0: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
alias: self
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php use B as PARENT;
|
||||
-----
|
||||
Cannot use B as PARENT because 'PARENT' is a special class name from 1:16 to 1:21
|
||||
array(
|
||||
0: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
alias: PARENT
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php use C as static;
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING from 1:16 to 1:21
|
||||
array(
|
||||
)
|
103
vendor/nikic/php-parser/test/code/parser/stmt/namespace/mix.test
vendored
Normal file
103
vendor/nikic/php-parser/test/code/parser/stmt/namespace/mix.test
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
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
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
42
vendor/nikic/php-parser/test/code/parser/stmt/namespace/name.test
vendored
Normal file
42
vendor/nikic/php-parser/test/code/parser/stmt/namespace/name.test
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
Different name types
|
||||
-----
|
||||
<?php
|
||||
|
||||
A;
|
||||
A\B;
|
||||
\A\B;
|
||||
namespace\A\B;
|
||||
-----
|
||||
array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_ConstFetch(
|
||||
name: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_ConstFetch(
|
||||
name: Name_Relative(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
30
vendor/nikic/php-parser/test/code/parser/stmt/namespace/nested.test
vendored
Normal file
30
vendor/nikic/php-parser/test/code/parser/stmt/namespace/nested.test
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
Nested namespaces are not allowed
|
||||
-----
|
||||
<?php
|
||||
namespace A {
|
||||
namespace B {
|
||||
|
||||
}
|
||||
}
|
||||
-----
|
||||
Namespace declarations cannot be nested from 3:5 to 5:5
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
45
vendor/nikic/php-parser/test/code/parser/stmt/namespace/notBraced.test
vendored
Normal file
45
vendor/nikic/php-parser/test/code/parser/stmt/namespace/notBraced.test
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
Semicolon style namespaces
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar;
|
||||
foo;
|
||||
|
||||
namespace Bar;
|
||||
bar;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
1: Bar
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
22
vendor/nikic/php-parser/test/code/parser/stmt/namespace/nsAfterHashbang.test
vendored
Normal file
22
vendor/nikic/php-parser/test/code/parser/stmt/namespace/nsAfterHashbang.test
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
Hashbang followed by namespace declaration
|
||||
-----
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
namespace A;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_InlineHTML(
|
||||
value: #!/usr/bin/env php
|
||||
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
58
vendor/nikic/php-parser/test/code/parser/stmt/namespace/outsideStmt.test
vendored
Normal file
58
vendor/nikic/php-parser/test/code/parser/stmt/namespace/outsideStmt.test
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
Some statements may occur outside of namespaces
|
||||
-----
|
||||
<?php
|
||||
declare(A='B');
|
||||
namespace B {
|
||||
|
||||
}
|
||||
__halt_compiler()
|
||||
?>
|
||||
Hi!
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: A
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: null
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_HaltCompiler(
|
||||
remaining: Hi!
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
/* Comment */
|
||||
;
|
||||
namespace Foo;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Nop(
|
||||
comments: array(
|
||||
0: /* Comment */
|
||||
)
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
105
vendor/nikic/php-parser/test/code/parser/stmt/namespace/outsideStmtInvalid.test
vendored
Normal file
105
vendor/nikic/php-parser/test/code/parser/stmt/namespace/outsideStmtInvalid.test
vendored
Normal file
|
@ -0,0 +1,105 @@
|
|||
There (mostly) can't be statements outside of namespaces
|
||||
-----
|
||||
<?php
|
||||
echo 1;
|
||||
echo 2;
|
||||
namespace A;
|
||||
-----
|
||||
Namespace declaration statement has to be the very first statement in the script on line 4
|
||||
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: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
namespace A {}
|
||||
echo 1;
|
||||
-----
|
||||
No code may exist outside of namespace {} from 3:1 to 3:7
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
namespace A {}
|
||||
declare(ticks=1);
|
||||
foo();
|
||||
namespace B {}
|
||||
-----
|
||||
No code may exist outside of namespace {} from 3:1 to 3:17
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: ticks
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: null
|
||||
)
|
||||
2: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
3: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue