php-parser/test/code/parser/stmt/class/constModifiers.test
Tomas Votruba 4c22c62783
[PHP 8.0] Add attributes support (#661)
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>
2020-09-13 21:01:17 +02:00

87 lines
2.2 KiB
Plaintext

Class constant modifiers
-----
<?php
class Foo {
const A = 1;
public const B = 2;
protected const C = 3;
private const D = 4;
}
-----
!!php7
array(
0: Stmt_Class(
attrGroups: array(
)
flags: 0
name: Identifier(
name: Foo
)
extends: null
implements: array(
)
stmts: array(
0: Stmt_ClassConst(
attrGroups: array(
)
flags: 0
consts: array(
0: Const(
name: Identifier(
name: A
)
value: Scalar_LNumber(
value: 1
)
)
)
)
1: Stmt_ClassConst(
attrGroups: array(
)
flags: MODIFIER_PUBLIC (1)
consts: array(
0: Const(
name: Identifier(
name: B
)
value: Scalar_LNumber(
value: 2
)
)
)
)
2: Stmt_ClassConst(
attrGroups: array(
)
flags: MODIFIER_PROTECTED (2)
consts: array(
0: Const(
name: Identifier(
name: C
)
value: Scalar_LNumber(
value: 3
)
)
)
)
3: Stmt_ClassConst(
attrGroups: array(
)
flags: MODIFIER_PRIVATE (4)
consts: array(
0: Const(
name: Identifier(
name: D
)
value: Scalar_LNumber(
value: 4
)
)
)
)
)
)
)