[php-src] Issue #8305: Class String Const cannot be set as Backed Enum Case
| From: | enobrev | Date: | Tue, 05 Apr 2022 17:15:24 +0000 |
| Subject: | [php-src] Issue #8305: Class String Const cannot be set as Backed Enum Case | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240674@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8305
Author: enobrev
### Description
The following code:
```php
<?php
class A {
final public const VALUE = 'something';
}
enum B: string {
case C = A::VALUE;
}
var_dump(B::C);
```
Resulted in this output:
```
PHP Fatal error: Enum case value must be compile-time evaluatable in /.../enum_const_string.php on
line 7
```
But I expected this output instead:
```
enum(B::C)
```
### PHP Version
PHP 8.1.4
### Operating System
_No response_