Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123190 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 2A7091A009C for ; Tue, 23 Apr 2024 17:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1713893300; bh=eqQ1/JJxrLZpFNs63LGCuG9IXmKV1vQkvFS8Ttqgics=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=k/o5N7vtqNyoztXvQDGN3jMmOAruY8+kpfOcBkbMZBIhzwO48AwUK62MqsmtBxBxA 7PAOjtG3OCotVJMs11wV22kzGyM7QAot2AKY2xNV+x6AASzawLkhoiZcOXmmv2KVpU bC4Y4f071nMtQXs7VVMnwuWPiYnOonJh6oeUqGihwvjMsu7RhjjhmXN9lutrwrRdZs HnjUjki678rgAbVLujXisXtSwbwIY8DCpky8Ev+/XjlWkhk+m7OscvPE6PMHlFpuOU DpzamD1NyQL79rqSE2DDswO+D+KgXFGoy5BYecqvXBV9UHSV5ZARhFMBdnXtI6HNUO SFMFL6yFDyoVQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 252FD18076C for ; Tue, 23 Apr 2024 17:28:20 +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,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: No X-Envelope-From: Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (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 ; Tue, 23 Apr 2024 17:28:19 +0000 (UTC) Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-36c1a7640ccso3784545ab.2 for ; Tue, 23 Apr 2024 10:27:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1713893258; x=1714498058; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=edyM/M30JZLArX/7nNKLkLsirICv4bX/VwKVWEQzbjA=; b=NnXnUkURzVCiGziM/xq8SyU0EqnltY3IDR68jncEZa8gHwRJHDleCAZhEuy01uGx7H JoaZtF7zVdyvwZE/8toOFlKogO9ETpRIKrYvzHFL7NAH4fDsyFQHGFQjhOh4RsjtS89q bE4aF05at24RTM+sCurzNYzXH9O+f4CsaOEcc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713893258; x=1714498058; h=content-transfer-encoding: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=edyM/M30JZLArX/7nNKLkLsirICv4bX/VwKVWEQzbjA=; b=Q6PwA/aHs1nDGSR9HTYBOFM9pZNE1ED04a0yoz42p2IrTzzKkIi2Syk+aXYbl/X6/N zFxvn4wFjFthMMHxIC/ct0Hypspzldf8c9DSG7rmTTWZPlMHGHQbd85O17HPQm/46uJx fhwslqGOQoHCS/jB4t/ZITzNub27lRwgJrm3Xx4zNxJC1gNaNHkzvse/3IwWv76atars FnF508gBkqJSiGyL63dnY1h+401uKig4b+7MVh0SSAi2n0OJaT/DXtcvvnDbQCZbR9Ig MUGN4P7F5LMrxRDRGiMC1GzRJr/KQ4hD2vpBJhilwubvktBM3uA7RrtdVPKmpuvxNXy3 vemQ== X-Gm-Message-State: AOJu0YyY32DNZ8w0ySMwb3/ZqG3JnZ8AJ+4h0JiEaz7V4MtHSz2EEFwx UkP8tsCNkUsu4Ww1Pa/lLcPtPN+8pVLMjkB4RDQHM3cDqqD4AKGdmlfuGY2JzAPnRUDs/iuzoDA Yja0jqqo6JIYWMQNd8P0PGgKnjbaEIzqqC4z0/WQUvIvFlntHgVD5dg== X-Google-Smtp-Source: AGHT+IGaRR7K5xi3BfkQ+LcX1yu4QAc7dRCMfckpLdeh4AIl7hDfSBCQuaEkXOvbU9FEIRFcAONJjuImEsZDh0UYAMI= X-Received: by 2002:a05:6e02:1a82:b0:36a:1e55:5358 with SMTP id k2-20020a056e021a8200b0036a1e555358mr180413ilv.18.1713893258477; Tue, 23 Apr 2024 10:27:38 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 23 Apr 2024 11:27:27 -0600 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] #[\Deprecated] attribute again v1.3 To: =?UTF-8?Q?Benjamin_Au=C3=9Fenhofer?= Cc: PHP Internals , "tim@tideways-gmbh.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: levi.morrison@datadoghq.com (Levi Morrison) 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 while no= w and after some off-list discussion a few weeks ago I have decided to revi= sit 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 featu= res such as #[Deprecated] support in stub generation. > > While there are still some small todos, at this point we want to restart = 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 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": ```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 ) { } } #[Deprecated(since: "1.3", note: "this is not good, use good_pls_use")] function bad_dont_use() {} #[Deprecated("this wasn't meant to be public, use good_pls_use instead") function oops_dont_use() {} function good_pls_use() {} ``` In Rust, you get a message for each of ["since" and "note"][2]. In PHP, this might look something like: > 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 [1]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-= deprecated-attribute [2]: https://github.com/rust-lang/rfcs/blob/master/text/1270-deprecation.= md#intended-use