Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127626 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 6E2301A00BC for ; Sun, 8 Jun 2025 18:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1749406111; bh=jdQ72c8Oale0mF1TPPM2wImI3BW2Zp1+lEkSq/o9eSE=; h=Date:From:To:Subject:From; b=hg03zKlTF0b+Dmf3WOxkModvBDjbhKtspmQqZFgcFdpTdnuek2uqu82KJZq9Q4yP0 BbQnBSUqGPYs9G/EHfm82FawaKGzusMn925uSAl7G5lXjyHNs7zLi+YeP529ZXuuyj ICr1CDXowfa3CWtUyoySSJzAKWe8r+aNwhR638zrB+OG5bWC26KoYSo3TuaUGRFYzV kmh/YypIe2UAm0TrN9P/yKvYu7QG9NeJnUKFTiJ4mF4Z+ohgILHfT3mP9WDfytSUJn /dkMQDddUubQoaCy3b8JHanzKxafLyf15blLiuCyuZsiD+TMCNVhrY1pKvRIY4oygb kXbG0yNBhRAjw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B152918006A for ; Sun, 8 Jun 2025 18:08:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout-b7-smtp.messagingengine.com (fout-b7-smtp.messagingengine.com [202.12.124.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 8 Jun 2025 18:08:29 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id E5161114013A for ; Sun, 8 Jun 2025 14:10:30 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-05.internal (MEProxy); Sun, 08 Jun 2025 14:10:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1749406230; x=1749492630; bh=jdQ72c8Oale0mF1TPPM2wImI3BW2Zp1+ lEkSq/o9eSE=; b=J5tLc4CQ7t4ze1v3OLfsrjDY+6oSEhsz7+m7lFcsu5Xxgg72 QT0bSxwKqbi7ZMv4/anep0jaA8HioOn9sG/EMf2pd1ve9qFQS3Qd6Bk6kdFXxczv IrsGPDYpcUxDzQnHQDaKPoqzqXDMFPpMcc0OaoDzeHhOyKqllwql44rUE8uVGH07 qZ4tp1+mWAmPfxowBBfvIvFQdBTl4zXunF47Bm9PRPKWU2I8pbJ/8k4W1A2lMPBh E1xO7ZHB5AQusCP+X/Jik30Rwmxt8fpjAyZ9Gn8lvjCLqbCeyqyRT92Ti9vwWuSF SdUwNSxOAxSmv+dugQ95+UT1hMaHZHTxtcbDfw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1749406230; x= 1749492630; bh=jdQ72c8Oale0mF1TPPM2wImI3BW2Zp1+lEkSq/o9eSE=; b=Z UN4IZmOZKflwuEMduytUoBssBQc7XcgqH3eBCN8dDoJjLi0WbZJqy9q6gZw8u1cR qB2P6qf64nANTqWHBZQ+v5jDwAYStToCiQHnkdMZSPWKejT+ZAM0aW5Luqu2Y2ba rp9ifNIalUMCjYqk5IgV7JdN0w5wVaJZDfQRfzernZmXWq1sL+I1AkOOpQUon/m8 1kC8S1t8SA9Uy72hRaGznH0f4t5OGbv3PJgSjJt61TNIuIyi3naLt4RyKvCle2gl UzojdycZv6h+4gPuwTMTTNswNwKJQN+VKYLYPXOWRDMIhG9hepGmJ66KKgqe096h VQ8SbP+5ughse+LcBneNQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdekvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucgoufhushhpvggtthffoh hmrghinhculdegledmnecujfgurhepofggfffhvffkufgtsegrtderreertdejnecuhfhr ohhmpedftfhosgcunfgrnhguvghrshdfuceorhhosgessghothhtlhgvugdrtghouggvsh eqnecuggftrfgrthhtvghrnhepleeukeefudegleekueduveegudeiveejvdeluedtveff heehvdelleeuieeiveeunecuffhomhgrihhnpeefvheglhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgssegsohhtthhlvggu rdgtohguvghspdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtph htthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 67C921820067; Sun, 8 Jun 2025 14:10:30 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Sun, 08 Jun 2025 20:10:10 +0200 To: internals@lists.php.net Message-ID: <30a02845-8bf5-421e-af1c-9cac3559ac1f@app.fastmail.com> Subject: [PHP-DEV] static properties in readonly classes Content-Type: multipart/alternative; boundary=3124c6e132bf4b91a2ec658ec0bb9b8e From: rob@bottled.codes ("Rob Landers") --3124c6e132bf4b91a2ec658ec0bb9b8e Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello internals, As far as I can tell from previous conversations and PRs; static propert= ies aren=E2=80=99t supported in readonly classes for technical reasons a= nd because nobody was sure what to do with them ...=20 ... but that seems weird because you can also do something like this: ht= tps://3v4l.org/uYNQD to hack your way around it if you want a mutable st= atic state encapsulated in the class. So, I would like to propose a question: should readonly classes be allow= ed to have static properties? And if so, should they be allowed to be mu= table? Or rather, should the static keyword also be prevented from being= used in readonly class methods? It just feels weird to say that "static properties aren=E2=80=99t allowe= d, but you can create static properties by embedding them in a method!" = In other words, it feels inconsistent. =E2=80=94 Rob --3124c6e132bf4b91a2ec658ec0bb9b8e Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello intern= als,

As far as I can tell from previous convers= ations and PRs; static properties aren=E2=80=99t supported in readonly c= lasses for technical reasons and because nobody was sure what to do with= them ...

... but that seems weird because you= can also do something like this: https://3v4l.org/uYNQD to hack your way around it if you want= a mutable static state encapsulated in the class.

<= div>So, I would like to propose a question: should readonly classes be a= llowed to have static properties? And if so, should they be allowed to b= e mutable? Or rather, should the static keyword also be prevented from b= eing used in readonly class methods?

It just fe= els weird to say that "static properties aren=E2=80=99t allowed, but you= can create static properties by embedding them in a method!" In other w= ords, it feels inconsistent.

=E2=80=94 Rob
--3124c6e132bf4b91a2ec658ec0bb9b8e--