Re: [PHP-DEV] [RFC] Primary Constructors

[email protected] ("Rowan Tommins [IMSoP]")
Newsgroups php.internals
Message-ID <[email protected]>
On 1 July 2026 09:51:00 BST, Nick Sdot <[email protected]> wrote:
>
> Just imagine you have to refactor an existing class with a primary constructor. `readonly` would prevent what you want to do and must be removed. This would require you to check and refactor the whole class, instead of just adding a body. It doesn't make sense.


I don't understand this paragraph at all. The proposed syntax doesn't change anything about how readonly works, as far as I know.

Any "primary constructor body" or "init block", whatever syntax it had, would have exactly the same abilities and limitations regarding readonly properties as a normal constructor. It would just be a different way of spelling it. 



Rowan Tommins
[IMSoP]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.