Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129921 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 0C5971A00BC for ; Sun, 25 Jan 2026 18:50:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769367039; bh=YyrEybS2q79pAxzS2DrhIKwKeJuSWeX5be+RBjSmw4w=; h=Date:From:To:In-Reply-To:References:Subject:From; b=NN+nZl/z8C35cUVqRsgeJ08Nik7nn92h8JtVgXQ2ucncA9wn5Xe716ICN2ku9FZbK Onkvw1rdQrswtvEagUQR+1LMcdmkbX2QftAQ7leOMkqT6+gp9d3BN8ImwtaJNtwpRk L9BYKsP9NBGG6/1iMtWE6ElKYbDa7/3h0XbeV4/T+nA9SVWzRqV5o1AiwFBQ65VxCN ThRMFGtdVVYekatUlKV0oHIUVXaH8WC81vaytJAg7NzuDGy6nYJSU5NpMwy56lOUVA Yy4md+8Q79xWmDq3yNhtFAF5cW0kRJFIWh9zJV3mrE23q6cd8LKFRq6F2F97tf3abg YGDVEv8Wd+w6w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E005418003B for ; Sun, 25 Jan 2026 18:50:38 +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=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 25 Jan 2026 18:50:38 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 832DE7A00AB for ; Sun, 25 Jan 2026 13:50:33 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Sun, 25 Jan 2026 13:50:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1769367033; x=1769453433; bh=0omKqTcQev20vT4wRinr3 PXUvT2sod0uMt4vFr2BYZo=; b=d+mD++mrzFWwLKzElHO7I0NHxlf99FlLEL5AP WKiyQG59e+JIvbVaO083WLaBTB6yLV+Ctu2p14Dxri5OcTAYwtv4LeePGQ1SIv+Y q1uHBRaqOA+eMaLG04QJSjJXOOGHIUTZWwbV1q1O4VeUILDsGvnzcvuc37cU1zo/ 9gh5DSsmvQOuZeX4PKYcCYW3H38YfjL07hCEM79+dyJrLxdv1PKnXZCS6LiDNLbd ARoW/3PuE50/qzBIPodkaWpzQYAysstk14fBKL9/tLzvrml7CbcNhO/EpA4EMMtF AgOeTVAh6fREP64mwxx/v+sApq76EpJtL0+X6cVHV3/pCnU2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1769367033; x=1769453433; bh=0 omKqTcQev20vT4wRinr3PXUvT2sod0uMt4vFr2BYZo=; b=OIBU2eOzsg12ZDOfu /izQf+wqubpB1hjI+SuP+FJtE2+8oqG/6y+zRFPf+IZx+nN69M0tPLoWXZTbhrAU FyWeW0tgmxZn8JUQyho3hovEcdRc3l4IrmaSxKJpIWS1ENS7RUm1yYdBUIMKXoj1 nHH3PThvHJ3I+mlDLy+SksoB6ksgDX/m1JrtVLLCuPTbkTOvsbH/AlGQvihzNtjw /jhZffJHkhvjGvOkcafk8DQAwygNoNm58zHRxx9yi6RSeJ2CdU0QjwDWd6cWCD0p +gQK+h7WBlY7ch1bRUYXobv0gO+fNopVw4x3OkmwKXI5tcmMoS7TZQiXnnS8gtNg OkPag== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduheehheehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpedugedvlefgueegheefjeetffduveeltefhfeegjeffffel gedttdevkeegkedugfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspghrtghp thhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsh eslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 3B174700069; Sun, 25 Jan 2026 13:50:33 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: ApWOO0YdA2Vg Date: Sun, 25 Jan 2026 12:50:13 -0600 To: "php internals" Message-ID: <1776f008-f444-4952-8f98-3a2693801145@app.fastmail.com> In-Reply-To: References: <077e27345a1f5b7969c114684aede7e8@bastelstu.be> <85e10caa-f577-4f8f-a93d-955348b67013@app.fastmail.com> Subject: Re: [PHP-DEV] [RFC] Allow Reassignment of Promoted Readonly Properties in Constructor Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Sat, Jan 24, 2026, at 12:09 PM, Nicolas Grekas wrote: >> Boring is good in this case. :-) I like the updates. I only have two remaining quibbles. >> >> > All other readonly semantics remain unchanged (no modification outside constructor, no unsetting, etc.) >> >> As previously stated, "no modification outside constructor" is not, and has never been, part of the language semantics of readonly. In fact, the RFC has been updated now such that updates outside of the constructor are allowed, provide the constructor is in the call stack. Please remove that clause, as it is incorrect. > > How would you phrase this? > To me, point 3 above makes this clear: "The reassignment must occur > while a constructor of the object is on the call stack (methods and > closures called from the constructor are allowed)" > Then, point 7: "All other readonly semantics remain unchanged (no > modification outside constructor, no unsetting, etc.)" has enough > context to me to be clear. > > No? There's a very subtle caveat here. Readonly properties that are not yet initialized can be set from anywhere, not just the constructor. That is the language semantic, regardless of what the PHPStan/Psalm authors think. :-) In this particular case, because the property is being set in the constructor preamble, essentially, it cannot then be re-assigned... EXCEPT in the constructor due to this RFC. But that's a subtle, easy to miss caveat. Hence why I'd prefer wording that doesn't imply (to those that don't catch that subtlety) that the language doesn't allow readonly to be assigned outside of the constructor. This is a particular pet peeve of mine because I have very good use cases for assigning to a readonly property outside of the constructor, but always therefore have to disable that check in PHPStan as a result. Hence why I harp on it so much. :-) --Larry Garfield