---
title: "[RFC] [Discussion] Literal Scalar Types"
url: https://daily.dev/posts/rfc-discussion-literal-scalar-types-atvhxrpml
source_url: https://externals.io/message/131306
type: article
source: "externals.io"
published: 2026-06-15T23:15:44.040Z
updated: 2026-06-15T23:16:06.402Z
tags: ["php"]
reading_time: 33
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# [RFC] [Discussion] Literal Scalar Types

**[externals.io](https://daily.dev/sources/externals)** · 33 min read · 0 upvotes · 0 comments

## Summary

A PHP internals mailing list discussion around a proposed RFC to add literal scalar types to PHP, allowing function signatures to express exact allowed values like `0|1|2` or `'success'|'error'`. The RFC author argues literal types fill gaps that enums cannot: describing existing scalar APIs without breaking callers, ad-hoc open value sets that can grow without BC breaks, and direct scalar interop (JSON round-trips, array keys, === comparisons with raw values). Skeptics counter that enums already handle most cases, backed enums cover scalar interop, and a non-exhaustive enum marker RFC could address open sets. The author concedes enums are better for named, reusable, behaviour-carrying sets, but maintains literal types are uniquely suited for typed scalar data on the wire, especially in future array shape typing scenarios.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://externals.io/message/131306>

## Similar posts on daily.dev

- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-mydo7w8tc) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-nthdmhsok) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-sdboyx9nd) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-frzrahcse) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-d1a06ix2k) · externals.io · 0 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php)

[View this post on daily.dev](https://daily.dev/posts/rfc-discussion-literal-scalar-types-atvhxrpml)
