Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123198 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 qa.php.net (Postfix) with ESMTPS id 559841A009C for ; Wed, 24 Apr 2024 12:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1713962608; bh=VQYYKAeb10mtOtj/a+9mzHJoZWd9pPKVFqC4HWetzgo=; h=In-Reply-To:References:Date:From:To:Subject:From; b=k7lVqgn1fX0b5a/4B/00a2qdGBNzjnrR8fOk8Eerf3SBFkXN/Ifi7vhRu3omWzFL7 BaCuUsHVamJWNchxeMMwykFng7mKnvy5utQ/MtYDjvZ05+8Gyid0xd2NpH0c0qtsjF aj5KvAHkSLgzCwKaPZuw7nqNcDfGzDmFFYh0iFqbaMLjoWauJMh4S8eRQ6ENsI08mk em+4g9BflPzwaM46pWV5Oc8ebA+G9JAoVPXc68MYj8USX5Dqnd/29ZZB4CxmsD1UMH 7ujJzcVQEy/tFF6g6NyLynby23+KxxkNTOFy79JKW0ZMGGEewPKzEl9z9ynrOmL2Vx yTNyWNR1HhcAQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6394E18006C for ; Wed, 24 Apr 2024 12:43:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) 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,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh5-smtp.messagingengine.com (fhigh5-smtp.messagingengine.com [103.168.172.156]) (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 ; Wed, 24 Apr 2024 12:43:26 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id DBB3A11400A6 for ; Wed, 24 Apr 2024 08:42:45 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Wed, 24 Apr 2024 08:42:45 -0400 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=fm3; t=1713962565; x=1714048965; bh=k7Uav/DGcSLm32HSwe5hR A3GH9fIKC9qAtFcbEaDkJM=; b=XmuVLFUDvCFZmrkFh582j0S1UxrcnPkAtla8z SDctby0eV2oUIK7ZBTeKjgMVHQcy5Ddv3Zb2Ll5WYJ84KFtwNZU3NtKZv0K5ySk6 eD7IN85Jlb+10XH15ZYsdAYpN5Odor0JCv4xk8yP3HF82N8z7GFb8dtuzGngFsvr hOITm9kqDU/hMqyzM1t/udK5ewjzyURqbL8uRvOiv5WWdjcf1OoxRWS/QAVbnOeu 0DztcDPWEB8vKoiq00HtwGZQ5S3khfgjPgT2wWp7jnxwEIbl8iEoo4e2bpdHBxpS PfqzsISKhSaoxYTtor192Js+grqlVc9rdioShjqRhGlSrPkvA== 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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1713962565; x= 1714048965; bh=k7Uav/DGcSLm32HSwe5hRA3GH9fIKC9qAtFcbEaDkJM=; b=i rvrssLHDNMd3sUsMVHBhraJo1IjNc5gVfFIMZwzQ1nsKKLWbI27IBG9W8gElmlnI JQZAd0ZXt91BegPHiv6rDi2oX1kcJJMmtflM6bfvqYABEW0c1b+5zYoHX6v8wuxj VXPn96MqFM2+/hL22aOfVlll5xMKYKXsrxhNs4imMfv9fCuaEOm731pBPsf/l5JK VxslHWcJk2LTN9GbaWkMEXHeXXXaLBggxyoJOIGxinCpT2W4ejOIpqAWWxMv1b9N CJYK8o+KKVoDNxrICmk47dR6LJkZEXSsOuIHN6xwOfJ4ErJa2YHspTHXbVHBNNMx +5H7zVnuBWERrBJG5519w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudelgedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgfduleevheehteeuieegfeduveefjeekjeejkedu tefhkefgudffveetteehiedtnecuffhomhgrihhnpehphhhprdhnvghtpdhgihhthhhusg drtghomhdpvgigthgvrhhnrghlshdrihhonecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 60FFB1700093; Wed, 24 Apr 2024 08:42:45 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-386-g4cb8e397f9-fm-20240415.001-g4cb8e397 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <6a1628bd-ba1a-4f2b-9bd1-9594db9734cc@app.fastmail.com> In-Reply-To: References: Date: Wed, 24 Apr 2024 07:42:20 -0500 To: "php internals" Subject: Re: [PHP-DEV] [RFC] [Discussion] #[\Deprecated] attribute again v1.3 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Wed, Apr 24, 2024, at 4:01 AM, Benjamin Au=C3=9Fenhofer wrote: > On Tue, Apr 23, 2024 at 7:27=E2=80=AFPM Levi Morrison=20 > wrote: >> On Tue, Apr 23, 2024 at 7:30=E2=80=AFAM Benjamin Au=C3=9Fenhofer wrote: >> > >> > Hi internals, >> > >> > My PR for #[\Deprecated] attribute was in hibernation for a long wh= ile now and after some off-list discussion a few weeks ago I have decide= d to revisit it and asked Tim to help me out with the work. >> > >> > Tim has cleaned up the PR quite a bit and also worked in additional= features such as #[Deprecated] support in stub generation. >> > >> > While there are still some small todos, at this point we want to re= start the discussion about the RFC for inclusion in 8.4: >> > >> > RFC: https://wiki.php.net/rfc/deprecated_attribute >> > PR: https://github.com/php/php-src/pull/11293 >> > Old discussion: https://externals.io/message/112554#112554 >> > >> > Let me know about your questions and feedback. >> > >> > greetings >> > Benjamin >>=20 >> I skimmed through the previous discussion and didn't see anything >> about adding a `since` property. This is occasionally useful, at least >> in my limited usage of it in Rust. The names below are modelled after >> the names in [Rust's deprecated attribute][1], but "note" is the same >> as the proposed "message": >>=20 >> ```php >> #[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION)] >> class Deprecated >> { >> public function __construct( >> public readonly ?string $note =3D null, >> public readonly ?string $since =3D null >> ) { >> } >> } >>=20 >> #[Deprecated(since: "1.3", note: "this is not good, use good_pls_use"= )] >> function bad_dont_use() {} >>=20 >> #[Deprecated("this wasn't meant to be public, use good_pls_use instea= d") >> function oops_dont_use() {} >>=20 >> function good_pls_use() {} >> ``` >>=20 >> In Rust, you get a message for each of ["since" and "note"][2]. In >> PHP, this might look something like: >>=20 >> > Deprecated: Function bad_dont_use() is deprecated since 1.3, >> > this wasn't meant to be public, use good_pls_use instead in %s >> > on line %d > > This request is similar to Roman's question about a replacement=20 > parameter elsewhere. We are unsure about these, because from an engine=20 > POV they do not add value, and from a user messaging perspective they=20 > could be put into the message with #[\Deprecated("since 1.3, this is=20 > not good, use good_pls_use")].=20 > > The only reason this might make sense is to allow third party tooling=20 > to work on this, but there are no conventions ala php-doc here in plac= e=20 > already. If tools need more infos, they could just introduce their own=20 > attributes. example: > > #[\Deprecated, Since("1.3"), Replacement("good_pls_use()")]. > > It feels arbitrary if we add parameters that the engine does not use=20 > and where no tooling conventions exist on how they are being used, so=20 > we left them out for now. I support this attribute, but would also like to see it fleshed out more= . A since parameter or a separate attribute I'm flexible on and open to= discussing; I don't have a strong preference right now. We should defi= nitely see what other languages have found useful here beyond just Rust,= which could give us a better idea of what is conventional/helpful. My other question is whether E_USER_DEPRECATED is still the right error = to throw, rather than E_DEPRECATED. I'm not saying it isn't, just that = I'm unsure and would like to dig into that a bit more. --Larry Garfield