1--TEST-- 2Final class constants 3--FILE-- 4<?php 5 6require __DIR__ . '/../util.php'; 7 8// In older php versions, this is allowed by the parser but forbidden by the compiler. 9$code = <<<'PHP' 10<?php 11class X { 12 final private const Y = 1; 13} 14PHP; 15 16$node = ast\parse_code($code, $version=70); 17echo ast_dump($node), "\n"; 18$node = ast\parse_code($code, $version=80); 19echo ast_dump($node), "\n"; 20--EXPECTF-- 21AST_STMT_LIST 22 0: AST_CLASS 23 name: "X" 24 docComment: null 25 extends: null 26 implements: null 27 stmts: AST_STMT_LIST 28 0: AST_CLASS_CONST_DECL 29 flags: MODIFIER_PRIVATE | MODIFIER_FINAL (%d) 30 0: AST_CONST_ELEM 31 name: "Y" 32 value: 1 33 docComment: null 34 __declId: 0 35AST_STMT_LIST 36 0: AST_CLASS 37 name: "X" 38 docComment: null 39 extends: null 40 implements: null 41 stmts: AST_STMT_LIST 42 0: AST_CLASS_CONST_GROUP 43 flags: MODIFIER_PRIVATE | MODIFIER_FINAL (%d) 44 const: AST_CLASS_CONST_DECL 45 0: AST_CONST_ELEM 46 name: "Y" 47 value: 1 48 docComment: null 49 attributes: null 50 attributes: null 51 __declId: 0 52