Closed
Description
Description
The following code:
<?php
#[AllowDynamicProperties]
enum Example {
case MyCase;
}
$c = Example::MyCase;
$c->prop = 'foo';
Resulted in this output:
Fatal error: Uncaught Error: Cannot create dynamic property Example::$prop in /in/Aqipu:9
Stack trace:
#0 {main}
thrown in /in/Aqipu on line 9
Process exited with code 255.
But I expected this output instead:
Fatal error: Cannot apply #[AllowDynamicProperties] to enum in /in/Aqipu on line 4
Process exited with code 255.
PHP Version
PHP 8.2
Operating System
No response