Re: [RFC] [Discussion] Readonly class amendments

From: Date: Wed, 30 Nov 2022 19:35:01 +0000
Subject: Re: [RFC] [Discussion] Readonly class amendments
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-119065@lists.php.net to get a copy of this message
On Wed, Nov 30, 2022, at 9:46 AM, Deleu wrote: > After reading GPB, Nicolas, Jordan and Larry's considerations, I no longer > have any objections to this RFC. Here is my summary of it all: > > - It's very easy for everyone to wrongly interpret readonly as somewhat > immutable, but it isn't (docs/education issue) > - LSP is about the writer of the child class, not about PHP > - If you don't want child classes to violate LSP, make your class `final > readonly` > - readonly as "constructor-init" properties mindset make it even stronger > the argument that child classes should be free to choose their definition > because constructors are special methods not bound by inheritance. Just for the record, my whole point is that "readonly as constructor-init" is wrong, and I am angry at the SA tools that have invented that out of whole cloth because it just breaks workflows that I am using very effectively and safely. I always turn off that check in those because they are wrong. That is *not* how the language feature is implemented, so making other language feature decisions based on that incorrect, artificial "rule" is highly dangerous. --Larry Garfield

« previous php.internals (#119065) next »