---
title: "[Pre-RFC] Scalar object methods (with a working implementation)"
url: https://daily.dev/posts/pre-rfc-scalar-object-methods-with-a-working-implementation--cintt2tj8
source_url: https://externals.io/message/131631
type: article
source: "externals.io"
published: 2026-06-29T23:42:51.056Z
updated: 2026-06-29T23:43:15.221Z
tags: ["php", "language-design"]
reading_time: 9
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.

# [Pre-RFC] Scalar object methods (with a working implementation)

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

## Summary

A pre-RFC proposal for scalar object methods in PHP is presented, allowing method calls directly on scalar values like `$str->trim()` or `(3)->pow(2)`. The approach dispatches only on receivers the compiler can syntactically guarantee are scalar at compile time, rewriting calls to internal backing classes with no new opcodes and negligible performance impact. The proposal includes two independently votable parts: scalar methods on guaranteed receivers, and scalar-typed local variables. A working implementation on PHP 8.6-dev is provided with BC impact analysis showing zero breaking changes across 173k+ Packagist files. A key objection raised is that PHP's file-by-file compilation model means cross-file return types won't qualify as guaranteed receivers, severely limiting real-world usability, and that hiding backing classes from static analysis tools creates tooling friction.

## Full article

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

## Similar posts on daily.dev

- [\[Pre-RFC\] Scalar object methods \(with a working implementation\)](https://daily.dev/posts/pre-rfc-scalar-object-methods-with-a-working-implementation--xpgxr6kkv) · externals.io · 0 upvotes · 0 comments
- [\[Pre-RFC\] Scalar object methods \(with a working implementation\)](https://daily.dev/posts/pre-rfc-scalar-object-methods-with-a-working-implementation--smq0sahal) · externals.io · 0 upvotes · 0 comments
- [\[Pre-RFC\] Scalar object methods \(with a working implementation\)](https://daily.dev/posts/pre-rfc-scalar-object-methods-with-a-working-implementation--rbej6xuyx) · externals.io · 0 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php), [#language-design](https://daily.dev/tags/language-design)

[View this post on daily.dev](https://daily.dev/posts/pre-rfc-scalar-object-methods-with-a-working-implementation--cintt2tj8)
