Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:126405
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 ECD131A00BD
	for <internals@lists.php.net>; Fri, 14 Feb 2025 11:48:43 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1739533561; bh=nNTV/FwnB++JTBpfFkUwbL7EWSkzQ165Net15N0ulmU=;
	h=Date:From:To:cc:Subject:In-Reply-To:References:From;
	b=fCgoMhI9oRHc1Y1FLTuqyYGhcAs2wpYLp/XjAHdZTgRMGU+Mlv/molvT6payvQKXd
	 WYplGoptR0wh2sfnsJlg59ViHCBrEczMqZqsrB2rulBOAx5DZPWltP2vGzezmVgo34
	 EcxheYzO8U/MUmf8pIpc0mGy7iNosTepYHPt9NLpo+TYUuiQjootxZtzd2yxOqT00K
	 zOZ0c5aNyx6GnyAim63w1rr+kqOlLYLcTQq/kFGyT497jB08X1Utt+y8ez/tSCRKZa
	 3xgUtB4jg17Kfu7RNZatAEqo2eA72ci5Y2t+I5U49osbsB6WNdMHO9epWneskIdyBo
	 hWcjbGY0sPGoQ==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 57A8D1801D7
	for <internals@lists.php.net>; Fri, 14 Feb 2025 11:45:59 +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=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS,
	SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.0
X-Spam-Virus: No
X-Envelope-From: <derick@php.net>
Received: from xdebug.org (xdebug.org [82.113.146.227])
	(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 <internals@lists.php.net>; Fri, 14 Feb 2025 11:45:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1739533718; bh=nNTV/FwnB++JTBpfFkUwbL7EWSkzQ165Net15N0ulmU=;
	h=Date:From:To:cc:Subject:In-Reply-To:References:From;
	b=d3bb07IF+aonEf6ruCl2g8RlQR5uD6PpWNBCd+2t7ZEcebl7zAxhwx/fogXflFR55
	 R0ZmnB2Yx5jWR4sSDUUXi1QC8mmGhJKHrJsJn1Hg+v+8iDV2Fe44nw0ChPf+4kR6fa
	 JGsU6ud9ZBrC3qJZ8dJpMssnqYFHqkRENdOR1GiJPkrp1enLYsjfTnInAU5D98CUT5
	 2lZ08Xo3PnNyg3Ezb9/aoi61CJzrbzLbI7AcBYSpXZkkIirZMgLyslwTaYGshAn8MN
	 Un7vFUvfQK3P4C0EC1xF48fo/4O9O+URrU8Asx6bjP4wNfuC7zfF77nSwg1vWTOzp+
	 GhcsuS2JwrsVQ==
Received: from localhost (localhost [IPv6:::1])
	by xdebug.org (Postfix) with ESMTPS id B171210C087;
	Fri, 14 Feb 2025 11:48:38 +0000 (GMT)
Date: Fri, 14 Feb 2025 11:48:37 +0000 (GMT)
To: Larry Garfield <larry@garfieldtech.com>
cc: php internals <internals@lists.php.net>
Subject: Re: [PHP-DEV] Re: RFC: Marking return values as important
 (#[\NoDiscard])
In-Reply-To: <374661dc-5193-4787-af4d-89cf2b983e15@app.fastmail.com>
Message-ID: <612a01e0-aef4-1bd6-aa4c-e0a9785dd801@php.net>
References: <a995ac24905030e168e7f6006b996cd5@bastelstu.be> <CAMzRQTcTrZR2=vnjvVZRt=fEJpiBci9HN36BQAwG8+FK60Gc1A@mail.gmail.com> <3d188924-33cf-4c3b-b7ff-3bd29232f16a@app.fastmail.com> <386df71fdd6818ddd54c771a889b7d5d@bastelstu.be>
 <374661dc-5193-4787-af4d-89cf2b983e15@app.fastmail.com>
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
List-Id: internals.lists.php.net
x-ms-reactions: disallow
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="8323329-1198297539-1739533718=:13815"
From: derick@php.net (Derick Rethans)

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323329-1198297539-1739533718=:13815
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Thu, 13 Feb 2025, Larry Garfield wrote:

> On Thu, Feb 13, 2025, at 8:16 AM, Tim D=C3=BCsterhus wrote:
> > Hi
> >
> > Am 2025-02-12 22:31, schrieb Larry Garfield:
> >> I'm still undecided on the RFC overall, but one thing that is=20
> >> problematic is the phrasing of the messages.  Currently, the messages=
=20
> >> in the attribute are fragments of an English sentence, seemingly=20
> >> designed to fit grammatically with a sentence fragment that is coded=
=20
> >> into the engine somewhere but not readily available to developers.
> >
> > Yes, the implementation of the error message very closely matches that=
=20
> > of #[\Deprecated] (except that there is no `since` bit to insert).
> >
> >> From my phrasing I think you can guess my opinion of that.
> >>=20
> >> That is impossible to document cleanly for English speakers.  It will=
=20
> >> not translate at all for anyone who is writing in a non-English=20
> >> language (which people do).  People are going to get it wrong more tha=
n=20
> >> they get it right, in any language.
> >>=20
> >> Instead, the wording should be structured to be a complete sentence,=
=20
> >> and the built-in message updated to make that logical.  That gives the=
=20
> >> developer much more freedom to write a meaningful,=20
> >> contextually-relevant message in the language of their choice.
> >
> > We're open to adjusting that. Do you have any suggestions? The=20
> > implementation of #[\Deprecated] works like it does, because PHP itself=
=20
> > already doesn't end the error messages with a `.`, as it appends `in=20
> > file.php on line 42`. This makes it inconvenient to have more than one=
=20
> > sentence in an error message, which is why we're struggling with coming=
=20
> > up with something better.
>=20
> Just spitballing:
>=20
> "Return value of foo() is not used, on foo.php line 5: <user text=20
> here>"
>=20
> Fiddle with the wording as needed, but by having a colon and then the=20
> user text, it makes it clear it's a separate statement, and can be as=20
> flexible as a statement in your chosen language wants to be.

PHP always adds "in file.php on line 42" to the end, so that wouldn't=20
work.

cheers,
Derick
--8323329-1198297539-1739533718=:13815--