---
title: "[RFC] [Discussion] Literal Scalar Types"
url: https://daily.dev/posts/rfc-discussion-literal-scalar-types-9myhaejd7
source_url: https://externals.io/message/131270
type: article
source: "externals.io"
published: 2026-06-15T12:26:53.033Z
updated: 2026-06-15T12:30:39.720Z
tags: ["php"]
reading_time: 11
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)** · 11 min read · 0 upvotes · 0 comments

## Summary

A PHP internals mailing list discussion around a new RFC proposing literal scalar types for PHP, allowing function signatures to express exact accepted values like `0|1|2` or `'ascii'|'utf-8'` directly in type hints. The RFC author argues this fills gaps that enums cannot: retrofitting existing scalar APIs without breaking callers, ad-hoc open value sets that can grow without BC breaks, and native scalar interop (array keys, JSON, strict equality). Participants debate whether enums already cover these use cases, with some noting backed enums handle scalar interop and that open-ended sets are a poor fit for both enums and literal unions. A suggestion to extend the feature with range types (e.g., `int -1..1`) is acknowledged as a logical follow-up but deferred to a separate proposal. Early community sentiment is cautiously positive, appreciating the simplicity of the feature.

## Full article

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

## Similar posts on daily.dev

- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-5cd5wculp) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-zupx3fo7j) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-ig40k0a5t) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-bcl1uxgwr) · externals.io · 0 upvotes · 0 comments
- [\[RFC\] \[Discussion\] Literal Scalar Types](https://daily.dev/posts/rfc-discussion-literal-scalar-types-9lcrg8ptz) · 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-9myhaejd7)
