mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-12-11 08:39:44 +01:00
55c4269232
Implement support for readonly properties (https://wiki.php.net/rfc/readonly_properties_v2) and final class contstants (https://wiki.php.net/rfc/final_class_const).
154 lines
3.2 KiB
Plaintext
154 lines
3.2 KiB
Plaintext
Invalid class constant modifiers
|
|
-----
|
|
<?php
|
|
class A {
|
|
static const X = 1;
|
|
}
|
|
-----
|
|
!!php7
|
|
Cannot use 'static' as constant modifier from 3:5 to 3:10
|
|
array(
|
|
0: Stmt_Class(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
name: Identifier(
|
|
name: A
|
|
)
|
|
extends: null
|
|
implements: array(
|
|
)
|
|
stmts: array(
|
|
0: Stmt_ClassConst(
|
|
attrGroups: array(
|
|
)
|
|
flags: MODIFIER_STATIC (8)
|
|
consts: array(
|
|
0: Const(
|
|
name: Identifier(
|
|
name: X
|
|
)
|
|
value: Scalar_LNumber(
|
|
value: 1
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
-----
|
|
<?php
|
|
class A {
|
|
abstract const X = 1;
|
|
}
|
|
-----
|
|
!!php7
|
|
Cannot use 'abstract' as constant modifier from 3:5 to 3:12
|
|
array(
|
|
0: Stmt_Class(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
name: Identifier(
|
|
name: A
|
|
)
|
|
extends: null
|
|
implements: array(
|
|
)
|
|
stmts: array(
|
|
0: Stmt_ClassConst(
|
|
attrGroups: array(
|
|
)
|
|
flags: MODIFIER_ABSTRACT (16)
|
|
consts: array(
|
|
0: Const(
|
|
name: Identifier(
|
|
name: X
|
|
)
|
|
value: Scalar_LNumber(
|
|
value: 1
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
-----
|
|
<?php
|
|
class A {
|
|
readonly const X = 1;
|
|
}
|
|
-----
|
|
!!php7
|
|
Cannot use 'readonly' as constant modifier from 3:5 to 3:12
|
|
array(
|
|
0: Stmt_Class(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
name: Identifier(
|
|
name: A
|
|
)
|
|
extends: null
|
|
implements: array(
|
|
)
|
|
stmts: array(
|
|
0: Stmt_ClassConst(
|
|
attrGroups: array(
|
|
)
|
|
flags: MODIFIER_READONLY (64)
|
|
consts: array(
|
|
0: Const(
|
|
name: Identifier(
|
|
name: X
|
|
)
|
|
value: Scalar_LNumber(
|
|
value: 1
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
-----
|
|
<?php
|
|
class A {
|
|
public public const X = 1;
|
|
}
|
|
-----
|
|
!!php7
|
|
Multiple access type modifiers are not allowed from 3:12 to 3:17
|
|
array(
|
|
0: Stmt_Class(
|
|
attrGroups: array(
|
|
)
|
|
flags: 0
|
|
name: Identifier(
|
|
name: A
|
|
)
|
|
extends: null
|
|
implements: array(
|
|
)
|
|
stmts: array(
|
|
0: Stmt_ClassConst(
|
|
attrGroups: array(
|
|
)
|
|
flags: MODIFIER_PUBLIC (1)
|
|
consts: array(
|
|
0: Const(
|
|
name: Identifier(
|
|
name: X
|
|
)
|
|
value: Scalar_LNumber(
|
|
value: 1
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|