Tag: enums
-
PHP Enumeration classes vs fake enumerations what to use.
I am growing to HATE PHP ENUMS. Why? Because if you forget to call ->value you get BS errors about cannot convert object to string. It is just another un-needed step. Enums sounded cool at first but fuq the BS with calling ->value, it is entirely too easy to forget. Enumeration classes in PHP are…
-
Faking Enumerations with Vanilla javascript
What is an Enumeration? An Enumeration is a way to create a limited list of options to choose from.This is useful for keeping a list of field names for a form so you can use javascript to animate something for example. Having a limited list of options is helpful so that you can eliminate bugs…
-
Php Backed Enums don’t forget to call value
The one thing I don’t like about new PHP enums is, if you forget to call ->value you get exceptions “object can’t be converted to string” It is entirely too easy to forget to call ->value. This means in places where I refactor code I have to remember to call ->value. Hence the article title…