3 ms·
Defiantly one of the best proposals for enums in PHP so far. It handles many of the needed requirements, reuses classes as building block so you get a type, can
by tored 6y ago
Defiantly one of the best proposals for enums in PHP so far. It handles many of the needed requirements, reuses classes as building block so you get a type, can have methods or case specific methods, can implement interfaces, can be mapped to a primitive value and solves the problem with strict equality beautifully.
One problem is that an enum can't be an index key of an array. Read why in this reddit thread between the authors of the RFC.
https://www.reddit.com/r/PHP/comments/k6w74p/rfc_enums/geo00su/ https://www.reddit.com/r/PHP/comments/k6w74p/rfc_enums/geo00...