---
title: "[Pre-RFC] Scalar object methods (with a working implementation)"
url: https://daily.dev/posts/pre-rfc-scalar-object-methods-with-a-working-implementation--g56edwffm
source_url: https://externals.io/message/131768
type: article
source: "externals.io"
published: 2026-07-04T20:41:12.969Z
updated: 2026-07-04T20:41:31.561Z
tags: ["php", "phpstan"]
reading_time: 4
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)** · 4 min read · 0 upvotes · 0 comments

## Summary

A PHP internals mailing list thread discussing a Pre-RFC proposal for scalar object methods — allowing syntax like `$s->trim()` as compile-time sugar for `Str::trim($s)`. The author clarifies dispatch rules: only typed locals, literals, casts, and typed properties are valid receivers; untyped variables never dispatch. The proposal uses .stub.php files (already consumed by PhpStorm, PHPStan, Psalm) for definitions, with a NUL-prefixed runtime symbol. Key design decisions include restricting user-function chaining to internal functions only, handling arity mismatches via normal ArgumentCountError/TypeError, and keeping the initial method set minimal to demonstrate the mechanism.

## Full article

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

## 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--j65oyhuep) · 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--hp2dpfngu) · externals.io · 1 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--evi9ihl2r) · externals.io · 0 upvotes · 0 comments

---

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

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