[php-src] Issue #15766: `ReflectionClass::toString()` should have better output for enums

From: Date: Thu, 05 Sep 2024 18:17:37 +0000
Subject: [php-src] Issue #15766: `ReflectionClass::toString()` should have better output for enums
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247710@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15766 Author: DanielEScherzer ### Description Tested against git master, see https://3v4l.org/hColU/rfc#vgit.master - when outputting a reflection class (or the subclass ReflectionEnum) for enums, the output be improved a bit (below each suggestion is a snippet from the current output) * the heading with the basic type information say that it is an enum, rather than a final class, and remove the interface implementations, instead indicating the backing type if any ``` Class [ <user> final class Suit implements UnitEnum ] { Class [ <user> final class MyBool implements UnitEnum, BackedEnum ] { ``` * the static properties entry can be removed, since it will always be empty (https://www.php.net/manual/en/language.enumerations.object-differences.php) ``` - Static properties [0] { } ``` * the "Constants" block should only include the regular class constants, and the cases be indicated separately, and for backed enums include their values ``` - Constants [5] { Constant [ public Suit Hearts ] { Object } Constant [ public Suit Diamonds ] { Object } Constant [ public Suit Clubs ] { Object } Constant [ public Suit Spades ] { Object } Constant [ public Suit OtherHearts ] { Object } } - Constants [3] { Constant [ public MyBool MyFalse ] { Object } Constant [ public MyBool MyTrue ] { Object } Constant [ public MyBool OtherTrue ] { Object } } ``` If there is support for these improvements, please assign this task to me

« previous php.bugs (#247710) next »