Elektrine lite

← Feed

@nyamsprod@phpc.social

Post #3860080

2026-07-16 13:59 UTC

@ramsey@phpc.social final class Duration { public int $microseconds { get => $this->ticks } public function __construct(private readonly $ticks) {} public static function zero(): self { static $instance = null; $instance ??= new self(0); return $instance; } } because of the hooks I loose the readonly property on the class and "singleton" nature ... now the in-memory cache no longer works it is better to return each time a new instance

Replies (1)