1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-04 18:28:25 +01:00
PHP-Parser/test/code/parser/stmt/namespace/groupUse.test
Nikita Popov 3da189769c Distinguish between implicit/explicit alias
The UseUse::$alias node can now be null if an alias is not
explicitly given. As such "use Foo\Bar" and "use Foo\Bar as Bar"
are now represented differently.

The UseUse->getAlias() method replicates the previous semantics,
by returning "Bar" in both cases.
2017-04-28 21:05:01 +02:00

188 lines
4.3 KiB
Plaintext

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: null
)
)
)
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: null
)
1: Stmt_UseUse(
type: TYPE_NORMAL (1)
name: Name(
parts: array(
0: D
)
)
alias: null
)
)
)
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: null
)
1: Stmt_UseUse(
type: TYPE_NORMAL (1)
name: Name(
parts: array(
0: E
)
)
alias: null
)
)
)
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: null
)
1: Stmt_UseUse(
type: TYPE_UNKNOWN (0)
name: Name(
parts: array(
0: d
)
)
alias: null
)
)
)
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: null
)
1: Stmt_UseUse(
type: TYPE_UNKNOWN (0)
name: Name(
parts: array(
0: D
)
)
alias: null
)
)
)
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: null
)
1: Stmt_UseUse(
type: TYPE_FUNCTION (2)
name: Name(
parts: array(
0: b
1: c
)
)
alias: null
)
2: Stmt_UseUse(
type: TYPE_CONSTANT (3)
name: Name(
parts: array(
0: D
)
)
alias: null
)
)
)
)