Re: Should there be a `get_declared_enums()` function ?
| From: | Nicolas Grekas | Date: | Fri, 16 Aug 2024 15:56:52 +0000 |
| Subject: | Re: Should there be a `get_declared_enums()` function ? | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-124984@lists.php.net to get a copy of this message | ||
On Fri, 16 Aug 2024, 16:46 Christoph M. Becker, <cmbecker69@gmx.de> wrote:
> On 16.08.2024 at 17:11, Nicolas
> >
> > And here is a one liner:
> >
> > function get_declared_enums() {
> > return array_filter(get_declared_classes(), 'enum_exists');
> > }
>
> Nice!
>
> Are you suggesting that there is no need for get_declared_enums() in the
> core, since it can be implemented in userland with a single function call?
>
> I think he just compulsively golfs inefficient PHP code (I have the same
> affliction).
>
Possibly :D
I shared this as food for thoughts. I'm not convinced this function would
be useful personally, but that's not really an argument ;)