---
title: "[RFC] [Discussion] Literal Scalar Types"
url: https://daily.dev/posts/rfc-discussion-literal-scalar-types-4qk0hq21r
source_url: https://externals.io/message/131293
type: article
source: "externals.io"
published: 2026-06-15T19:00:31.193Z
updated: 2026-06-15T19:00:55.122Z
tags: ["php"]
reading_time: 16
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)** · 16 min read · 0 upvotes · 0 comments

## Summary

A PHP internals mailing list discussion around a new RFC proposing literal scalar types for PHP. The RFC would allow function signatures to express exact scalar values as types, e.g. `function check(-1|0|1 $x): void {}`. The 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). Community members debate whether enums already cover these cases, raise questions about constant references and enum values in type positions (both out of scope), and discuss mixing literal types with wider types in unions (supported by design). A range syntax like `-1..1` is acknowledged as a logical follow-up but intentionally excluded from this RFC. An alternative approach via pattern matching parameter guards is also mentioned.

## Full article

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

## Similar posts on daily.dev

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