[php-src] Issue #8344: Attribute parameters cannot contain BackedEnum values

From: Date: Mon, 11 Apr 2022 18:57:29 +0000
Subject: [php-src] Issue #8344: Attribute parameters cannot contain BackedEnum values
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-240843@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8344 Author: michnovka ### Description The following code: ```php <?php enum Status: string { case DRAFT = 'draft'; case PUBLISHED = 'published'; case ARCHIVED = 'archived'; } #[Attribute] class ListensTo { public string $event; public function __construct(string $event) { $this->event = $event; } } #[ListensTo(Status::DRAFT->value)] class TestClass {} ``` Resulted in this output: ``` PHP Fatal error: Constant expression contains invalid operations on line 23 ``` But I expected it would work fine ### PHP Version PHP 8.1.4 ### Operating System Ubuntu 20.04

« previous php.bugs (#240843) next »