[php-src] Issue #7821: Can't use inherited constant value via 'self'
| From: | wbars | Date: | Thu, 23 Dec 2021 15:03:16 +0000 |
| Subject: | [php-src] Issue #7821: Can't use inherited constant value via 'self' | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238548@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7821
Author: wbars
### Description
The following code:
```php
<?php
interface I {
public const DEFAULT_VALUE = 'gambrinus';
}
enum Beer: string implements I {
// case GAMBRINUS = I::DEFAULT_VALUE;
case GAMBRINUS = self::DEFAULT_VALUE;
}
var_dump(Beer::GAMBRINUS);
```
Resulted in this output:
```
Fatal error: Enum case value must be compile-time evaluatable in /in/Oqm7f on line 9
```
But I expected this output instead:
No errors, because commented
case GAMBRINUS = I::DEFAULT_VALUE produces no error
### PHP Version
8.1.1
### Operating System
_No response_