---
title: "[RFC] [Discussion] Literal Scalar Types"
url: https://daily.dev/posts/rfc-discussion-literal-scalar-types-55axctmuf
source_url: https://externals.io/message/131300
type: article
source: "externals.io"
published: 2026-06-15T19:56:55.349Z
updated: 2026-06-15T19:57:16.877Z
tags: ["php"]
reading_time: 27
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)** · 27 min read · 0 upvotes · 0 comments

## Summary

A PHP internals mailing list discussion about 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 enums cannot: describing existing scalar APIs without breaking callers, ad-hoc open value sets that can grow without BC breaks, and direct scalar interoperability (JSON round-trips, array keys, === comparisons with raw values). Respondents debate whether enums already cover these cases, with one contributor arguing the strongest use case is typing structured scalar payloads like decoded JSON responses where enum conversion overhead is undesirable. A counter-proposal for a non-exhaustive enum marker is also mentioned as an alternative approach.

## Full article

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

## Similar posts on daily.dev

- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-2aiigdwsn) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-utnsqqo2d) · 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-sdboyx9nd) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-uf16kwcmw) · externals.io · 1 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-55axctmuf)
