Re: [VOTE] Readonly properties
| From: | Ilija Tovilo | Date: | Sat, 03 Jul 2021 12:00:46 +0000 |
| Subject: | Re: [VOTE] Readonly properties | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115280@lists.php.net to get a copy of this message | ||
Hi
> Thanks for the RFC. A quick question, is it allowed to assign to a readonly property multiple
> times within the construction method? Sorry for it if someone has asked this before, because
> actually I didn't go through the whole thread, only did a quick search on it. Thanks.
No, assignment is exclusively allowed under two conditions:
1. The property is declared in the same class
2. The property is uninitialized
This means you won't be able to change a property once you've written
a value to it, even in the constructor.
Ilija