Re: [RFC] Readonly properties
| From: | Matthew Brown | Date: | Fri, 04 Jun 2021 18:43:44 +0000 |
| Subject: | Re: [RFC] Readonly properties | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-114732@lists.php.net to get a copy of this message | ||
This is a great idea!
Might be worth mentioning that Psalm already supports a
@readonly
docblock annotation (first suggested by Nuno Maduro), and it matches the
proposed behaviour (though Psalm doesn't currently prevent inheritance
issues):
Example: https://psalm.dev/r/7ed5872738
On Fri, 4 Jun 2021 at 11:19, Nikita Popov <nikita.ppv@gmail.com> wrote:
> Hi internals,
>
> I'd like to open the discussion on readonly properties:
> https://wiki.php.net/rfc/readonly_properties_v2
>
> This proposal is similar to the
> https://wiki.php.net/rfc/write_once_properties RFC that has
> been declined
> previously. One significant difference is that the new RFC limits the scope
> of initializing assignments. I think a key mistake of the previous RFC was
> the confusing "write-once" framing, which is both technically correct and
> quite irrelevant.
>
> Please see the rationale section (
> https://wiki.php.net/rfc/readonly_properties_v2#rationale) for
> how this
> proposal relates to other RFCs and alternatives.
>
> Regards,
> Nikita
>