Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123937 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 2F6951A009C for ; Thu, 27 Jun 2024 11:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719486696; bh=N6VIM8zJjgnOAqd9g8p1Ipk955Mpp8nWlpLArS2Z3+A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nMJyeFdnpMM+KDaRx4FJfFCHgAN+xg5TmbAiJdD+lmC+K6vbo/rlnzZjWZC9UDUF1 fP7PBpeUjeZRQcOKQkBHqBvuySTEXyPoX59cK/vt6yOEymbN8qJzcaXTU10gtjsKn6 sExxGaT8pV/KHEq0otj2dYbve9GJfWmoiw2hiD4MkMsoRrGKW5UJAPC7hPJsotQY4c fZAjGX5THJmrP5iYPoBKiahC3/5hU++aXH0H3/rH6A+KCtRNIfK6m+BVaj4lPYYpNj 2GrZh8K+gGwCXbMAnKQ/cirYC13S1qZTEfJhBUcwCDUXol3N7FSZjPyWr9mlOaIyQw T//VGIGaEvRMw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3F4771806CB for ; Thu, 27 Jun 2024 11:11:35 +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=1.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 ; Thu, 27 Jun 2024 11:11:34 +0000 (UTC) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-52e764bb3fbso77142e87.3 for ; Thu, 27 Jun 2024 04:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719486615; x=1720091415; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=N6VIM8zJjgnOAqd9g8p1Ipk955Mpp8nWlpLArS2Z3+A=; b=IQ7asPoS2DY09nqqEONqNhfyX2zAC3TLCvOaK63OhAmFNPRnT9r16uB5Z4BCBoTTdm Zs0digVr5BFzoh4MDOW/ZMRMIsqcVp+QK2bEL5RuMs0Z7m/i1WTK310p/1WZquXDuXzO 3njHGPF7Tcr4DxxKHFrDXpGHz0QvBYMyjCHclhBJpcsJFvruyAENrFwz5QPFwYOp6aj8 kKH0ZfYaqOUWhwIvCjde2RxUqQT5+EtWZSo/+VfcP9f+St23k33QmQBxuWJtmVPIeIG/ 978AS0uPpQ0ZWCkaXIqbJlBUj01Tf6fRh5IRMSUWbaPWXvf9WSfEhSTPI8QYXNFxdH1D uYQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719486615; x=1720091415; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=N6VIM8zJjgnOAqd9g8p1Ipk955Mpp8nWlpLArS2Z3+A=; b=oUwplVMwHf9dsmDr31h1vzAS8kGDZnlZoCXd3vipdMHqzxYIWI9bI3C837W0R1PxU7 +F+5sruO79z2yjEHM6RtM3jHNB3+M0jL1LgMMNxFaDZ66cI9+KGNu4Iw6aiubNOtAksZ PiP5/AIBK9D4zz21y/B+333sUwd6PO1VJUsOmEC1jBHw4Y/4s9/YB9zZfRPqOHAj6ND0 NKZcOOwxtTbrWU++1y7EFUkOrzd2utsoYehW+BBcElQzbLfI1BYN5dAkivEsytD/c18S im+7eqvaoXpujAXZO9HphFyR8ODt7eHpdxO0FGcyipLcTQwwBFDK3hhGHjGTYU+PIAI1 1TaQ== X-Gm-Message-State: AOJu0YycruWEtnRSqIDjWnyV6DPb+pxhxpbE6HW6Q+Vy/zETd8Z13/HS lLmgeJP53DGqMqnTYoi4SJq0o8r2vUDiISTvhnjLkEOg+QXsS76vSY8RYm2O/LjWGo6zWh1ZVfj GHjkuYwzyTiN5BLg69ixg9WVFQZI= X-Google-Smtp-Source: AGHT+IF+S5YDDjDS+dwZ8XI2IdBzi4XF+2v61ij3uoiqH0GRMZ1J9mvdmys47WAXEd7h0fgYbHlZnRBEyinE6GTQGgE= X-Received: by 2002:a19:6454:0:b0:52c:dae5:6511 with SMTP id 2adb3069b0e04-52ce18345a6mr7874887e87.23.1719486614775; Thu, 27 Jun 2024 04:10:14 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 27 Jun 2024 13:10:02 +0200 Message-ID: Subject: Re: [PHP-DEV] Re: [RFC] [Vote] #[\Deprecated] attribute To: =?UTF-8?Q?Benjamin_Au=C3=9Fenhofer?= , =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000deb5fb061bdd2c8a" From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000deb5fb061bdd2c8a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le mar. 25 juin 2024 =C3=A0 22:01, Benjamin Au=C3=9Fenhofer a =C3=A9crit : > > > On Mon, Jun 24, 2024 at 5:07=E2=80=AFPM Nicolas Grekas < > nicolas.grekas+php@gmail.com> wrote: > >> >> >> Le mer. 5 juin 2024 =C3=A0 10:18, Benjamin Au=C3=9Fenhofer a >> =C3=A9crit : >> >>> >>> >>> On Wed, May 22, 2024 at 9:22=E2=80=AFAM Benjamin Au=C3=9Fenhofer >>> wrote: >>> >>>> The vote for the RFC #[\Deprecated] attribute is now open: >>>> >>>> https://wiki.php.net/rfc/deprecated_attribute >>>> >>>> Voting will close on Wednesday 5th June, 08:00 GMT. >>>> >>> >>> The #[\Deprecated] attribute has been accepted with 23 (Yes) to 6 (No) >>> votes, 79%. >>> >>> >>> The secondary vote to include Deprecated::$since has also been accepted >>> with 22 (Yes) to 1 (No) votes, 96%. >>> >>> >>> Thank you to everyone for voting! >>> >>> >>> Tim will finalize the implementation PR now and work on its merge in th= e >>> upcoming days. >>> >> >> Hi Benjamin, >> >> The vote for the RFC #[\Deprecated] attribute is now open: >>>> >>>> https://wiki.php.net/rfc/deprecated_attribute >>>> >>>> Voting will close on Wednesday 5th June, 08:00 GMT. >>>> >>> >>> The #[\Deprecated] attribute has been accepted with 23 (Yes) to 6 (No) >>> votes, 79%. >>> >>> >>> The secondary vote to include Deprecated::$since has also been accepted >>> with 22 (Yes) to 1 (No) votes, 96%. >>> >>> >>> Thank you to everyone for voting! >>> >>> >>> Tim will finalize the implementation PR now and work on its merge in th= e >>> upcoming days. >>> >> >> Since the vote passed, we're discussing how we might use the attribute i= n >> Symfony. >> 2 things on the topic: >> >> 1/ We're wondering about using it at the class level despite the missing >> Attribute::TARGET_CLASS. ReflectionAttribute does allow reading >> attributes without checking these flags and we might leverage this >> capability to make our DebugClassLoader able to inspect those at the cla= ss >> level. >> >> Would you consider adding Attribute::TARGET_CLASS in 8.4 already? It >> would just make sense to me. We don't need the engine to do anything abo= ut >> deprecated classes ever since all we need in userland is a class-loader >> that checks for the attribute. Keeping the engine simpler and empowering >> userland with maximum flexiblity FTW. I'm up for a quick RFC if the >> consensus is this needs one. >> > > We have started loosly thinking about the behavior of > Attribute::TARGET_CLASS for a next PHP RFC already, and allowing this > before the behavior is introduced seems like a bad precedent to me, so I > agree with Tim that we probably shouldn't do that. > That's sad news, because I keep explaining why engine-triggered runtime notices are a terrible idea, yet you're planning to add more of them. The consistency argument Tim wrote in another email isn't sound to me: consistency with a bad idea doesn't make a good idea. In the hope it may be used as food for thoughts: when we use `@deprecated` on a class, Symfony's DebugClassLoader throws a deprecation ONLY when a class *extends* one of those `@deprecated` classes. For the runtime notice itself, we decide case by case among two possibilities: either triggering the notice just before the class declaration, or in the constructor. The reason is that sometimes we have to load the class but we don't want to trigger the deprecation because loading the class doesn't trigger any side-effects that users should be warned about in relation to the deprecation. In such situations, we trigger in the constructor. About Attribute::TARGET_CLASS itself, not adding it right now will lead to a situation where userland will have a hard time writing code that's compatible with both 8.4 and 8.5 (assuming 8.5 is the moment where the flag is added): using #[Deprecated] will be "illegal" when running on 8.4, yet legal when running in 8.5? That's another reason to allow the flag right away: smooth upgrades. My suggestion is quite restricted, and that'd solve all my concerns: it is to enable the flag right now, and to add ReflectionClass::isDeprecated() right now also if you want. But don't plan anything more on the topic, except maybe a deprecation notice when *extending* a #[Deprecated] class. But nothing more please. No runtime notice when loading the class. Nicolas --000000000000deb5fb061bdd2c8a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
Le=C2=A0mar. 25 juin 2024 =C3=A0=C2= =A022:01, Benjamin Au=C3=9Fenhofer <kontakt@beberlei.de> a =C3=A9crit=C2=A0:


On= Mon, Jun 24, 2024 at 5:07=E2=80=AFPM Nicolas Grekas <nicolas.grekas+php@gmail.= com> wrote:


Le=C2=A0mer. 5 juin 2024 =C3=A0=C2= =A010:18, Benjamin Au=C3=9Fenhofer <kontakt@beberlei.de> a =C3=A9crit=C2=A0:

Hi Benjamin,

The= #[\Deprecated] attribute has been accepted with 23 (Yes) to 6 (No) votes, = 79%.

The secondary vote to include Deprecated::$since has also been accepted wi= th 22 (Yes) to 1 (No) votes, 96%.


Thank you to everyone for voting!


Tim will finalize the imp= lementation PR now and work on its merge in the upcoming days.


Since the vote passed, we're discus= sing how we might use the attribute in Symfony.
2 things on the t= opic:

1/ We're wondering about using it at= the class level despite the missing Attribute::TARGET_CLASS.=C2=A0ReflectionAttribut= e does allow reading attributes without checking these flags and we might leverage this capability to make our DebugClassLoader able to inspect=20 those at the class level.
=
Would you consider ad= ding Attribute::= TARGET_CLASS in 8.4 already? It would just make sense to me. We don't need the=20 engine to do anything about deprecated classes ever since all we need in userland is a class-loader that checks for the attribute. Keeping the=20 engine simpler and empowering userland with maximum flexiblity FTW. I'm= =20 up for a quick RFC if the consensus is this needs one.

We have = started loosly thinking about the behavior of Attribute::TARGET_CLASS for a= next PHP RFC already, and allowing this before the behavior is introduced = seems like a bad precedent to me, so I agree with Tim that we probably shou= ldn't do that.=C2=A0

= That's sad news, because I keep explaining why engine-triggered runtime= notices are a terrible idea, yet you're planning to add more of them. = The consistency argument Tim wrote in another email isn't sound to me: = consistency with a bad idea doesn't make a good idea.
In the hope it may be used as food for thoughts: when we use `@= deprecated` on a class, Symfony's DebugClassLoader throws a deprecation= ONLY when a class *extends* one of those `@deprecated` classes.
= For the runtime notice itself, we decide case by case among two possibiliti= es: either triggering the notice just before the class declaration, or in t= he constructor. The reason is that sometimes we have to load the class but = we don't want to trigger the deprecation because loading the class does= n't trigger any side-effects that users should be warned about in relat= ion to the deprecation. In such situations, we trigger in the constructor.<= /div>

About=C2=A0Attribute::TARGET_CLASS itself, not add= ing it right now will lead to a situation where userland will have a hard t= ime writing code that's compatible with both 8.4 and 8.5 (assuming 8.5 = is the moment where the flag is added): using #[Deprecated] will be "i= llegal" when running on 8.4, yet legal when running in 8.5?
=
That's another reason to allow the flag right away: smoo= th upgrades.

My suggestion is quite restricted= , and that'd solve all my concerns: it is to enable the flag right now,= and to add ReflectionClass::isDeprecated() right now also if you want. But= don't plan anything more on the topic, except maybe a deprecation noti= ce when *extending* a #[Deprecated] class. But nothing more please. No runt= ime notice when loading the class.


Nicol= as
--000000000000deb5fb061bdd2c8a--