-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support PHP 7.1 class constant visibility
a) CLASS_CONST_DECL now uses modifier flags. For PHP < 7.1 we emuate MODIFIER_PUBLIC here for consistency. b) CONST_ELEM can now have a docComment properts (in analog to the property on PROP_ELEM).
- Loading branch information
Showing
5 changed files
with
83 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--TEST-- | ||
Class constants | ||
--SKIPIF-- | ||
<?php if (PHP_VERSION_ID < 70100) die('skip PHP >= 7.1 only'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
require __DIR__ . '/../util.php'; | ||
|
||
$code = <<<'PHP' | ||
<?php | ||
class Test { | ||
/** Doc A */ | ||
const A = 1; | ||
public const B = 2; | ||
protected const C = 3; | ||
private const D = 4; | ||
const | ||
/** Doc E */ | ||
E = 5, | ||
/** Doc F */ | ||
F = 6; | ||
} | ||
PHP; | ||
|
||
echo ast_dump(ast\parse_code($code, $version=30)); | ||
|
||
?> | ||
--EXPECT-- | ||
AST_STMT_LIST | ||
0: AST_CLASS | ||
flags: 0 | ||
name: Test | ||
extends: null | ||
implements: null | ||
stmts: AST_STMT_LIST | ||
0: AST_CLASS_CONST_DECL | ||
flags: MODIFIER_PUBLIC (256) | ||
0: AST_CONST_ELEM | ||
docComment: /** Doc A */ | ||
name: "A" | ||
value: 1 | ||
1: AST_CLASS_CONST_DECL | ||
flags: MODIFIER_PUBLIC (256) | ||
0: AST_CONST_ELEM | ||
name: "B" | ||
value: 2 | ||
2: AST_CLASS_CONST_DECL | ||
flags: MODIFIER_PROTECTED (512) | ||
0: AST_CONST_ELEM | ||
name: "C" | ||
value: 3 | ||
3: AST_CLASS_CONST_DECL | ||
flags: MODIFIER_PRIVATE (1024) | ||
0: AST_CONST_ELEM | ||
name: "D" | ||
value: 4 | ||
4: AST_CLASS_CONST_DECL | ||
flags: MODIFIER_PUBLIC (256) | ||
0: AST_CONST_ELEM | ||
docComment: /** Doc E */ | ||
name: "E" | ||
value: 5 | ||
1: AST_CONST_ELEM | ||
docComment: /** Doc F */ | ||
name: "F" | ||
value: 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters