We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9e1871 commit bc03deeCopy full SHA for bc03dee
Zend/tests/enum/magic-constants.phpt
@@ -0,0 +1,14 @@
1
+--TEST--
2
+Backed enums can contain magic constants
3
+--FILE--
4
+<?php
5
+
6
+enum Foo: string {
7
+ case Bar = __FILE__;
8
+}
9
10
+echo Foo::Bar->value, "\n";
11
12
+?>
13
+--EXPECTF--
14
+%smagic-constants.php
Zend/zend_compile.c
@@ -10474,6 +10474,9 @@ static void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
10474
case ZEND_AST_NAMED_ARG:
10475
zend_eval_const_expr(&ast->child[1]);
10476
return;
10477
+ case ZEND_AST_CONST_ENUM_INIT:
10478
+ zend_eval_const_expr(&ast->child[2]);
10479
+ return;
10480
default:
10481
10482
}
0 commit comments