On Tue, Feb 24, 2026, at 12:52 PM, Joshua Rüsweg wrote:

>> I would prefer starting with readonly parameters as I feel that would
>> bring the most value.
>
> I find the idea of readonly parameters interesting and have already 
> given it some thought. However, it is out of scope for this RFC, as I 
> wanted to keep the initial proposal focused and manageable. I have 
> already mentioned it in the Future Scope section of the RFC as a 
> potential natural extension that could be addressed in a separate RFC 
> in the future.

A slight tangent here, but what would readonly parameters do?

If you pass something by value, then already you cannot modify the value in the 
caller.  If the value is large, it's already kept efficient by copy-on-write.

If you pass by reference, then presumably you *want* to modify the value in the 
caller.

If the value is an object, then as already discussed, its internals are mutable 
either way so you gain little, but the function cannot change the identity in 
the caller anyway.

So I don't see what readonly parameters would even accomplish.  The thing they 
accomplish in JS or Java or C simply doesn't apply in PHP.

I'm still undecided at the moment on readonly variables.

--Larry Garfield

Reply via email to