Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:108214
Return-Path: <nicolas.grekas@gmail.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 44063 invoked from network); 22 Jan 2020 17:38:04 -0000
Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5)
  by pb1.pair.com with SMTP; 22 Jan 2020 17:38:04 -0000
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 6D40018053B
	for <internals@lists.php.net>; Wed, 22 Jan 2020 07:47:00 -0800 (PST)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net
X-Spam-Level: 
X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,
	RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,
	SPF_PASS autolearn=no autolearn_force=no version=3.4.2
X-Spam-ASN: AS15169 209.85.128.0/17
X-Spam-Virus: No
X-Envelope-From: <nicolas.grekas@gmail.com>
Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by php-smtp4.php.net (Postfix) with ESMTPS
	for <internals@lists.php.net>; Wed, 22 Jan 2020 07:46:59 -0800 (PST)
Received: by mail-ot1-f51.google.com with SMTP id 77so6645555oty.6
        for <internals@lists.php.net>; Wed, 22 Jan 2020 07:46:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=mime-version:from:date:message-id:subject:to;
        bh=VNePNB8HNWEKtmxFLwPpBU1v/zCPkev53jSRE0E8wKw=;
        b=WX5i/N21L3SMZziKqS+Hi/AEUe3S7lGaNz5B7hIxWQ0ycEMLwlCT57F54l3wPbugNW
         m8TNghXm5Lu4ujMYeSg9YpB7OBVzBWGtddqf7OR2BAkovoVrOgh1kT84T3SGuylhJ+rI
         kbJCHRGXYVvM03/gHBt5lfO0csQbnvY/0bIyDbK/P7UjYPn5bKhTnjT2EqzSfBt2idqL
         26hWQueb91m8MgpDsDHI+wqnsebMF2nqLw+6XPGr8u49v0LgMkdox8t0LOlpQdbwXhLd
         QuMKgwwB+OC7TEYf1W9s+YKaS1dofO2JUCk7QfHyWD4AN8Bk8y5TReyrm2XSpFbOrZfO
         JkjQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
        bh=VNePNB8HNWEKtmxFLwPpBU1v/zCPkev53jSRE0E8wKw=;
        b=uKED30pgDEvtPLDRFmeJ4ZNL5n7vkob1A+4LFzRzKGO1/N6FHoElnUmkfYf207vKPT
         eU9usllImXOpFsvsFYtiZm84IHOdvB54qQxQ/ezu3tDQiYuQKxzJJIegjSdiGoQKzx2A
         eb8bTcdua8/uykL1/tjpitLTF4sE8eS4HliItj4Akcfc/BsE2tZDzBPwEnr3bj8EHYaD
         ZBrQ+sHy4j2NQ0NeCcImlHlQzRS66KYryaQIChr/yVg1PccBuYtZ87y1Q50QFv/gD27m
         Z44gwpKkMJ6No2ymzrjyzZHHuZw3odJ/3Op8y5+yndgzYYjaCz5HmqLpa59SIuBZOoBR
         TD+Q==
X-Gm-Message-State: APjAAAV1IvbqgBNkxYrVGnhhQdKR2r/yVfWDgANlIbHqCuK7Gmzipjsg
	zrB9cWs6g3oGLbMpiWNEBAksTe7PcZ+9zjBI5gCciah1J7E=
X-Google-Smtp-Source: APXvYqwL+UyMA64OHFc+LQdrsgOr5OOQrl3Ui4Xun2NwsdiZ7vgJ7TNiLDdITuWF5ZZ5ShfBlLz6mdtQkna93YM7Ruw=
X-Received: by 2002:a05:6830:1198:: with SMTP id u24mr7521349otq.215.1579708015545;
 Wed, 22 Jan 2020 07:46:55 -0800 (PST)
MIME-Version: 1.0
Date: Wed, 22 Jan 2020 16:46:42 +0100
Message-ID: <CAOWwgp=STMdOnp9NHn35-mm7TdZD3KKk5PwSGKXeqTyaDBoYHA@mail.gmail.com>
To: PHP Internals List <internals@lists.php.net>
Content-Type: multipart/alternative; boundary="0000000000001d923c059cbc6f83"
Subject: [RFC] Adding a "Stringable" interface to PHP 8
From: nicolas.grekas+php@gmail.com (Nicolas Grekas)

--0000000000001d923c059cbc6f83
Content-Type: text/plain; charset="UTF-8"

Hello everyone,

as announced last week, I'm officially opening a discussion for adding a
"Stringable" interface to PHP 8.

The RFC and its rationale are presented here as required:
https://wiki.php.net/rfc/stringable

The patch is found on GitHub, where some discussions happened already, you
might be interested in having a look:
https://github.com/php/php-src/pull/5083

TL;DR, I think we need an interface to allow passing objects with a
__toString() method in a type-safe way, using the string|Stringable type.
Here is the stub of the proposal:
interface Stringable { public function __toString(): string; }

I invite everyone to review the RFC before commenting here as I tried to
sum up considerations that some already had before and that you might have
too.

Cheers,
Nicolas

--0000000000001d923c059cbc6f83--