Re: Should there be a `get_declared_enums()` function ?
| From: | Juliette Reinders Folmer | Date: | Mon, 19 Aug 2024 14:28:51 +0000 |
| Subject: | Re: Should there be a `get_declared_enums()` function ? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125046@lists.php.net to get a copy of this message | ||
On 15-8-2024 3:51, Juliette Reinders Folmer wrote:
L.S., I just noticed the following, which struck me as weird/inconsistent: There are four different OO structures in PHP: 1. Classes 2. Interfaces 3. Traits 4. Enums For all four, anNot responding to anyone in particular, but just letting you all know that Ayesh and me will work up an RFC for this. I will email the list when we've published it to open the official discussion period. Smile, Juliette*_exists()function is available, i.e.class_exists(),interface_exists(),trait_exists()andenum_exists()[2]. But only for three out of the four, aget_declared_*()function exists. There isget_declared_classes(),get_declared_interfaces(),get_declared_traits(), but noget_declared_enums()[2]. I'm aware that enums are internally considered classes and thatget_declared_classes()will retrieve them [1], but the same could be said about interfaces and traits, yet they do have their ownget_declared_*()function. Should aget_declared_enums()function be added ? And should theget_declared_classes()function be adjusted to exclude enums ? I did check the enum RFC [3], but I couldn't find any mention or discussion about this in the RFC. Smile, Juliette 1: https://3v4l.org/0ub6I 2: https://www.php.net/manual/en/ref.classobj.php 3: https://wiki.php.net/rfc/enumerations