mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-02 17:38:19 +01:00
4c22c62783
Adds support for PHP 8 attributes, represented using `AttrGroup` nodes containing `Attribute` nodes. The `attrGroup` subnode is added to all nodes that can have attributes. This is still missing FPPP support. Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
194 lines
5.5 KiB
Plaintext
194 lines
5.5 KiB
Plaintext
Traits
|
|
-----
|
|
<?php
|
|
|
|
trait A {
|
|
public function a() {}
|
|
}
|
|
|
|
class B {
|
|
use C;
|
|
use D {
|
|
a as protected b;
|
|
c as d;
|
|
e as private;
|
|
}
|
|
use E, F, G {
|
|
E::a insteadof F, G;
|
|
E::b as protected c;
|
|
E::d as e;
|
|
E::f as private;
|
|
}
|
|
}
|
|
-----
|
|
array(
|
|
0: Stmt_Trait(
|
|
attrGroups: array(
|
|
)
|
|
name: Identifier(
|
|
name: A
|
|
)
|
|
stmts: array(
|
|
0: Stmt_ClassMethod(
|
|
attrGroups: array(
|
|
)
|
|
flags: MODIFIER_PUBLIC (1)
|
|
byRef: false
|
|
name: Identifier(
|
|
name: a
|
|
)
|
|
params: array(
|
|
)
|
|
returnType: null
|
|
stmts: array(
|
|
)
|
|
)
|
|
)
|
|
)
|
|
1: Stmt_Class(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
name: Identifier(
|
|
name: B
|
|
)
|
|
extends: null
|
|
implements: array(
|
|
)
|
|
stmts: array(
|
|
0: Stmt_TraitUse(
|
|
traits: array(
|
|
0: Name(
|
|
parts: array(
|
|
0: C
|
|
)
|
|
)
|
|
)
|
|
adaptations: array(
|
|
)
|
|
)
|
|
1: Stmt_TraitUse(
|
|
traits: array(
|
|
0: Name(
|
|
parts: array(
|
|
0: D
|
|
)
|
|
)
|
|
)
|
|
adaptations: array(
|
|
0: Stmt_TraitUseAdaptation_Alias(
|
|
trait: null
|
|
method: Identifier(
|
|
name: a
|
|
)
|
|
newModifier: MODIFIER_PROTECTED (2)
|
|
newName: Identifier(
|
|
name: b
|
|
)
|
|
)
|
|
1: Stmt_TraitUseAdaptation_Alias(
|
|
trait: null
|
|
method: Identifier(
|
|
name: c
|
|
)
|
|
newModifier: null
|
|
newName: Identifier(
|
|
name: d
|
|
)
|
|
)
|
|
2: Stmt_TraitUseAdaptation_Alias(
|
|
trait: null
|
|
method: Identifier(
|
|
name: e
|
|
)
|
|
newModifier: MODIFIER_PRIVATE (4)
|
|
newName: null
|
|
)
|
|
)
|
|
)
|
|
2: Stmt_TraitUse(
|
|
traits: array(
|
|
0: Name(
|
|
parts: array(
|
|
0: E
|
|
)
|
|
)
|
|
1: Name(
|
|
parts: array(
|
|
0: F
|
|
)
|
|
)
|
|
2: Name(
|
|
parts: array(
|
|
0: G
|
|
)
|
|
)
|
|
)
|
|
adaptations: array(
|
|
0: Stmt_TraitUseAdaptation_Precedence(
|
|
trait: Name(
|
|
parts: array(
|
|
0: E
|
|
)
|
|
)
|
|
method: Identifier(
|
|
name: a
|
|
)
|
|
insteadof: array(
|
|
0: Name(
|
|
parts: array(
|
|
0: F
|
|
)
|
|
)
|
|
1: Name(
|
|
parts: array(
|
|
0: G
|
|
)
|
|
)
|
|
)
|
|
)
|
|
1: Stmt_TraitUseAdaptation_Alias(
|
|
trait: Name(
|
|
parts: array(
|
|
0: E
|
|
)
|
|
)
|
|
method: Identifier(
|
|
name: b
|
|
)
|
|
newModifier: MODIFIER_PROTECTED (2)
|
|
newName: Identifier(
|
|
name: c
|
|
)
|
|
)
|
|
2: Stmt_TraitUseAdaptation_Alias(
|
|
trait: Name(
|
|
parts: array(
|
|
0: E
|
|
)
|
|
)
|
|
method: Identifier(
|
|
name: d
|
|
)
|
|
newModifier: null
|
|
newName: Identifier(
|
|
name: e
|
|
)
|
|
)
|
|
3: Stmt_TraitUseAdaptation_Alias(
|
|
trait: Name(
|
|
parts: array(
|
|
0: E
|
|
)
|
|
)
|
|
method: Identifier(
|
|
name: f
|
|
)
|
|
newModifier: MODIFIER_PRIVATE (4)
|
|
newName: null
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
) |