Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123402 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 417561A009C for ; Wed, 22 May 2024 08:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1716366295; bh=n5DBmnpfnBVHCPUfxH5yhIrc9v0oxA6KFJUzQTUtxko=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oQx/3T4+sqeH3j7dPG8aE1ZZeEXz8OU0LQyFOhUBa42Qjj5sm5rU9Y0g/nMO7S3G2 UNdpr9R5Z6D4VfhfZHCcO+M6WWtgc6XtPMK5yFKJJiRzAKAITvrM5wSjip7DkytvAw Cv71j1JGFCTzikalA6QrCe4+/oVdhlxMmXKOhQk6aq3AOefpkGAxntNLIUbTaIgorl YBPXXKk/v4e+ObkdV+eM8L+GjnImVJVtTI3PHvp5akBBNPTwZ9OIBsGnPVTsyEYQ/3 E2G+TSvqLr3Ngow84WsQwvPOQKSqKImyPja6dBhr8iqnWeAXdR18WFMDdl4wpHEL5u 6DL2lki2EO3pA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 25369180819 for ; Wed, 22 May 2024 08:24:54 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, 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-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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, 22 May 2024 08:24:53 +0000 (UTC) Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-354e0d4db6cso150488f8f.0 for ; Wed, 22 May 2024 01:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716366236; x=1716971036; 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=dowPXmo989hP3jPCm/E3IF4aT4d15GBTQ0lssIFrVEE=; b=HFf6SgQs11vIu5tMwo9I7L/VjjllDCJccuJ8Oj/dyp+/7P4YrUFqf0REF3wG9LszDc wAZdML2EOoFGaRxTezJbEoEtaiZHKUeuUKJ+GV7XntKIX+1Rfma4b72pmgF5DmdCtsEk h+GkeYQCUMT04IfHk2Ct6gQmKsiRHbptqAakkoqnZTOujbu3HFE7LXdhmz0AuURcuiHg FRwSfp6gdDSIRQNymGqUYC+ts/+F5sjGQSi8fcQtQr+VZOaQ5ehJADDTZRm6p9qQB8NR F3QaUaQ5ZzyIxdR1slo4srBGrQ2vnu2hzn9zICcfl+NQwIfx4kgmf4oNxtoQEMgY1XT9 uHKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716366236; x=1716971036; 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=dowPXmo989hP3jPCm/E3IF4aT4d15GBTQ0lssIFrVEE=; b=XSNFwlHg5lN1Hq5/toaG7VS0XcLmBoerICH4TutrcFpMwyvISsVaQfNT3XdBtUv+jJ FKl1PxWN/QZvO/XtvyVTsXEUUMC6m37RQ5iGmKegx1yZ3XEIKoqQ6vwg2igy+FIvWOi3 nGe0tkJyMhrLQS22RSubqGgsjXixOhbtw5kpXuyledcqoX8pxzN/P10k6TMiuAvW6XIg eRvJcBWHXhj75BIwfM/6nv4q/RfxpmqITmG5l7YwXTZgoE2Z9wpshyQ6bVypCeIlCI1K c10X/iRVnKu7tAsYzTdRtf1QNhGyLx11SWQ/G4NzpkOtrePWUPPrXQuekdjtQfn2nAjl eNFQ== X-Forwarded-Encrypted: i=1; AJvYcCW2L49TPSQvT8Hj4G4n7Yq61pg5FH2YWMWc+wIOvyU6/0YNT+ihpGg7mEbeyREFz2NI62KAnTuXT+FGxjfDsMvlexxGKV+Fug== X-Gm-Message-State: AOJu0YzQVGArKpi6Xi+4QOV6NHxx2D8DcY/MmQra5pTZGM1sQWeJ9aQo KSIa1xpsG0cxS2Bc9QdTzzc53HP+3DhbAyZftel8dFfOmNF56OVDnPNM4VTSPFN/9QVRlUumbWi WbNBbYs+B+c2lcM0s2G9COXY9CNQ= X-Google-Smtp-Source: AGHT+IHJaIsre6/j1uxqUyZjEHvUpDFRbuN7A8xXQo3nsLCx1XnVY1TcQt0MWhqM2KtDZfy/dyarM4m0q1qAXoUw+gE= X-Received: by 2002:adf:dd87:0:b0:34c:600b:b016 with SMTP id ffacd0b85a97d-354d81147dbmr1195137f8f.27.1716366236034; Wed, 22 May 2024 01:23:56 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 22 May 2024 11:23:19 +0300 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Vote] #[\Deprecated] attribute To: Pierre Cc: Nicolas Grekas , =?UTF-8?Q?Benjamin_Au=C3=9Fenhofer?= , PHP Internals Content-Type: multipart/alternative; boundary="000000000000cdadf8061906a7ca" From: arvids.godjuks@gmail.com (Arvids Godjuks) --000000000000cdadf8061906a7ca Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 22 May 2024 at 11:01, Pierre wrote: > Le 22/05/2024 =C3=A0 09:33, Nicolas Grekas a =C3=A9crit : > > 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. >> > > I voted "no" because I think this is better addressed in userland, as thi= s > gives more flexibility. > I would better have an attribute that is made only for static analysis > with no runtime side effects at all. > Being forced to make the attribute final because the implementation in th= e > engine requires is an example of why the engine is not the correct place = to > send this notice. Another example is not being able to add the attribute = on > classes because [engine reasons]. > > trigger_error() is better fitted for the runtime side-effect when it's > desired. > In my opinion, #[Deprecated] should be only for static analysers / > reflection (although this would need another discussion - I'm not sure th= is > would benefit being in the engine vs in a userland package. > > Thanks for the RFC anyway. > > Nicolas > > I'm always dubious when I read the "this can be addressed or better > addressed in userland": as soon as you need something as little as the > Deprecated attribute, if it's not in core but in userland, you encounter > two very serious issues: first one, fragmentation, every framework, > organisation, or static analysis tool will have its own variant, second o= ne > if the community converges toward a single one, you then will be dependen= t > on a certain framework or huge tooling. > > I can see many benefits in having this in core, one being that every > static analyzer will implement it using the core attribute, so any projec= t > and developer using it can choose any static analysis tooling without > having to change or adapt its code everywhere, or learning a different > convention in order to use different tools. > > That's my 2 cents, but the "better in userland" argument seems to me > almost always biased or wrong. Especially for this Deprecated argument, > this a very common need, and each project Doctrine, Symfony, any tool > implement it in a different manner. I don't want to be rude, but as a > developer using all of those, it's very annoying having to learn differen= t > ways of doing something as simple and naive that saying that a function i= s > deprecated. One manner is sufficient, even if not perfect. > > -- > > Pierre > Hello everyone. I have to agree with Pierre on this one as a userland developer. To give a good illustration: Guzzle. I'm trying to get rid of it in my code base and use SF HttpClient (mostly for the sole reason that guzzle truncates replies in their exceptions without any ability to configure that and cutting off all actually useful information about why request failed) and... I can't... Because some other package is hardwired to Guzzle and refuses any attempts to inject a different HttpClient. Which forces me to roll my own implementations, thankfully making API clients is fairly simple= . A Deprecated attribute belongs in the core. --=20 Arv=C4=ABds Godjuks +371 26 851 664 arvids.godjuks@gmail.com Telegram: @psihius https://t.me/psihius --000000000000cdadf8061906a7ca Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, 22 May 2024 at 11:01, Pierre = <pierre-php@processus.org> wrote:
= =20 =20 =20
Le 22/05/2024 =C3=A0 09:33, Nicolas Grekas a =C3=A9crit=C2=A0:
=20
Hi Benjamin,


I voted "no" because I think this is better addres= sed in userland, as this gives more flexibility.
I would better have an attribute that is made only for static analysis with no runtime side effects at all.
Being forced to make the attribute final because the implementation in the engine requires is an example of why the engine is not the correct place to send this notice. Another example is not being able to add the attribute on classes because [engine reasons].

trigger_error() is better fitted for the runtime side-effect when it's desired.
In my opinion, #[Deprecated] should be only for static analysers / reflection (although this would need another discussion - I'm not sure this would benefit being in the engine vs in a userland package.

Thanks for the RFC anyway.

Nicolas

I'm always dubious when I read the "this can be addressed o= r better addressed in userland": as soon as you need something as little as the Deprecated attribute, if it's not in core but in userland, you encounter two very serious issues: first one, fragmentation, every framework, organisation, or static analysis tool will have its own variant, second one if the community converges toward a single one, you then will be dependent on a certain framework or huge tooling.

I can see many benefits in having this in core, one being that every static analyzer will implement it using the core attribute, so any project and developer using it can choose any static analysis tooling without having to change or adapt its code everywhere, or learning a different convention in order to use different tools.

That's my 2 cents, but the "better in userland" argume= nt seems to me almost always biased or wrong. Especially for this Deprecated argument, this a very common need, and each project Doctrine, Symfony, any tool implement it in a different manner. I don't wan= t to be rude, but as a developer using all of those, it's very annoying having to learn different ways of doing something as simple and naive that saying that a function is deprecated. One manner is sufficient, even if not perfect.

--

Pierre

Hello everyone.

I have to agree with = Pierre on this one as a userland developer.=C2=A0
To give a good = illustration: Guzzle. I'm trying to get rid of it in my code base and u= se SF HttpClient (mostly for the sole reason that guzzle truncates replies = in their exceptions without any ability to configure that and cutting off a= ll actually useful information about why request failed) and... I can't= ... Because some other package is hardwired to Guzzle and refuses any attem= pts to inject a different HttpClient. Which forces me to roll my own implem= entations, thankfully making API clients is fairly simple.
A Depr= ecated attribute belongs in the core.=C2=A0

--

Arv=C4=ABds Godjuks+371 26 851 664
Telegram: @psihius= =C2=A0https://t.me/psihi= us
--000000000000cdadf8061906a7ca--