Post #3861718
2026-07-16 15:26 UTC
@ramsey@phpc.social @nyamsprod@phpc.social
class Duration {
public private(set) self $zero { get => $this->zero ??= new self(0); }
}
Poof, cached. (Typed on my phone, excuse code typos.)
Replies (1)
-
@nyamsprod@phpc.social 2026-07-16 16:01
@Crell@phpc.social @ramsey@phpc.social I still love me some good ol' readonly better known as writeOnce and forget about it 😈 . And now you have an instance method not a named constructor ... which is another issue in design IMHO