|
|
|
|
|
by CiaranMcNulty
2021 days ago
|
|
>So, singletons. That way you end up with more global state, with all its consequences. As you point out, the lack of properties solves that. The use of a singleton probably relates to the identity issue > at this point you may just as well skip the entire object part as I don't see why exactly it's needed for an identity check. PHP only has 8 types (string, int, bool, float, array, null, resource, object) and they're not likely to be added to (resource is largely deprecated). Given that, object is the only one that's not likely to be abused by relying on the actual scalar value. Keeping it as a singleton ensures that === will still work (it requires 'same instance') |
|
There's one more thing not addressed by the RFC: how to check for a particular enum to exist. The way I see it, a new function "enum_exists" would be needed and validating a QCN would become this ugly:
class_exists($qcn) || enum_exists($qcn) || interface_exists($qcn) || trait_exists($qcn)