It passed 16 to 2, with 5 abstaining, clearing the two-thirds majority it needed. Voting closed on April 16, 2026, and the change shipped in PHP 8.6.
Debugable Enums
Lets enums define __debugInfo() to control what var_dump() shows for an enum case.
Allow __debugInfo() in enums?
This poll has closed.
Summary
__debugInfo() is the magic method that controls what var_dump() shows for an object. When enums arrived in PHP 8.1, they blocked most magic methods, including __debugInfo(). This RFC from Daniel Scherzer lets enums define it.
The original enum RFC blocked most magic methods because they deal with state, and enum cases don't have state. __debugInfo() doesn't need state, though, so blocking it wasn't necessary.
Show me
Here's a backed enum with its own __debugInfo():
enum Foo: string { case Bar = "Baz"; public function __debugInfo() { return [__CLASS__ . '::' . $this->name . ' = ' . $this->value]; } } var_dump(Foo::Bar);
That prints:
enum(Foo::Bar) (1) {
[0]=>
string(14) "Foo::Bar = Baz"
}
The enum(Foo::Bar) header stays in the output, and your array shows up below it. Unit enums, the ones with no backing value, can use it the same way.
How it works
PHP removes the compile error you'd get for adding __debugInfo() to an enum. The normal checks for that method still apply, so it must have the right visibility, arguments and return type.
The first version of this idea was different: it would have allowed __toString() on enums. Feedback on the mailing list led to this rewrite.
PHP's own enums, like \Random\IntervalBoundary, don't get a __debugInfo() method from this RFC, though that may come later.
What it means for existing code
Nothing breaks, since the RFC only removes an error. Static analysis tools that warn about __debugInfo() in enums will need an update for PHP 8.6 and later.