Describe the bug
PDT incorrectly reports an error when accessing enum case values (->value) inside a static class property initializer. The same code works correctly at runtime and is valid in PHP 8.1+. Moving the same expression into a method removes the error, suggesting a parser limitation.
Describe the eclipse environment
eclipse 2026-03
PDT - 8.4
Expected behavior
No errors in the IDE
This is valid PHP 8.1+ syntax
Code runs correctly
Actual behavior
IDE error Constant expression contains invalid operations
<?php
declare(strict_types=1);
enum ExampleKey: string
{
case FOO = 'foo';
case BAR = 'bar';
}
class ExampleClass
{
private static array $DATA = [
['id' => null, 'label' => 'None'],
['id' => ExampleKey::FOO->value, 'label' => 'Foo'],
['id' => ExampleKey::BAR->value, 'label' => 'Bar'],
];
public static function getData(): array
{
return self::$DATA;
}
}```
Describe the bug
PDT incorrectly reports an error when accessing enum case values (->value) inside a static class property initializer. The same code works correctly at runtime and is valid in PHP 8.1+. Moving the same expression into a method removes the error, suggesting a parser limitation.
Describe the eclipse environment
eclipse 2026-03
PDT - 8.4
Expected behavior
No errors in the IDE
This is valid PHP 8.1+ syntax
Code runs correctly
Actual behavior
IDE error Constant expression contains invalid operations