Re: [RFC] Readonly Property Defaults
| From: | Nick Sdot | Date: | Mon, 13 Jul 2026 18:21:39 +0000 |
| Subject: | Re: [RFC] Readonly Property Defaults | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131900@lists.php.net to get a copy of this message | ||
Hey Tim,
On 14.07.26 00:56, Tim Düsterhus wrote:
Hi On 2026-07-13 19:52, Nick Sdot wrote:Got it. Yes, no specialities. In case you deem it necessary I could add an assertion to an existing test. Something like:Not exactly sure what you would like me to spell me out. It's indeed different things. I made a tiny addition to the non-goals. Let me know if that's enough or if you had something else in mind.That works for me, thanks. The concern I had was just that “default values for constructor property promotion are special” and thus spelling it out once more that they are special, but that the RFC will not introduce new specialness is a good thing. Best regards Tim Düsterhus
class Foo { public function __construct( public readonly string $a = 'bar') {} }
var_dump(new ReflectionClass(Foo::class)->getProperty('a')->hasDefaultValue()) // bool(false)
To me it feels just not too related, and in other reviews I got commented for over-testing.
But up to you. Feel free to let me know.
Maybe "no specialities" can "promote" you from team abstain to team yes. ;)
--
Cheers
Nick