mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-07-24 15:51:32 +02:00
Add support for function and constant import (PHP 5.6)
This commit is contained in:
@@ -9,9 +9,16 @@ 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: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
@@ -25,6 +32,7 @@ array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Use(
|
||||
type: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
@@ -38,6 +46,7 @@ array(
|
||||
)
|
||||
)
|
||||
2: Stmt_Use(
|
||||
type: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
@@ -59,6 +68,7 @@ array(
|
||||
)
|
||||
)
|
||||
3: Stmt_Use(
|
||||
type: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
@@ -71,6 +81,7 @@ array(
|
||||
)
|
||||
)
|
||||
4: Stmt_Use(
|
||||
type: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
@@ -82,4 +93,60 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Use(
|
||||
type: 2
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: bar
|
||||
)
|
||||
)
|
||||
alias: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Stmt_Use(
|
||||
type: 2
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: bar
|
||||
)
|
||||
)
|
||||
alias: baz
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Stmt_Use(
|
||||
type: 3
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: BAR
|
||||
)
|
||||
)
|
||||
alias: BAR
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Stmt_Use(
|
||||
type: 3
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: BAR
|
||||
)
|
||||
)
|
||||
alias: BAZ
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
20
test/code/prettyPrinter/alias.test
Normal file
20
test/code/prettyPrinter/alias.test
Normal file
@@ -0,0 +1,20 @@
|
||||
Aliases (namespacing)
|
||||
-----
|
||||
<?php
|
||||
|
||||
use A\B;
|
||||
use C\D as E;
|
||||
use F\G as H, J;
|
||||
|
||||
use function foo\bar;
|
||||
use function foo\bar as baz;
|
||||
use const foo\BAR;
|
||||
use const foo\BAR as BAZ;
|
||||
-----
|
||||
use A\B;
|
||||
use C\D as E;
|
||||
use F\G as H, J;
|
||||
use function foo\bar;
|
||||
use function foo\bar as baz;
|
||||
use const foo\BAR;
|
||||
use const foo\BAR as BAZ;
|
Reference in New Issue
Block a user