A PHP internals mailing list thread discussing a new RFC proposing literal scalar types for PHP. The RFC would allow type signatures like `0|1|2` or `"ascii"|"utf-8"` as actual type constraints. The author argues literal unions fill gaps enums cannot: they can describe existing scalar APIs without breaking callers, support open value sets that grow without BC breaks, and work natively as scalars (array keys, JSON, strict equality) unlike enum objects. A skeptic counters that enums already cover most use cases, with backed enums handling scalar interop. A third participant expresses tentative support for the simplicity the feature offers.
213 Impressions