Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108215 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58711 invoked from network); 22 Jan 2020 19:05:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Jan 2020 19:05:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EFFF6180531 for ; Wed, 22 Jan 2020 09:14:15 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE 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: Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 ; Wed, 22 Jan 2020 09:14:14 -0800 (PST) Received: by mail-wm1-f50.google.com with SMTP id q9so7609873wmj.5 for ; Wed, 22 Jan 2020 09:14:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BVDKxFA5xfnV6Ptt9fZIxDl7bZ3tyRXP9MQEQifgpG0=; b=PPLVkAS+mcWJasbtKdNuXd4g70H/8qNCI8fuzCLV/rLOxOjOfr6F/qxqlQKHV0ecjg JsGFjpz98dfFAbQyhtungLF/9n+COlksaZf+We42GWFGYkEUWKlZJXCUaVVdFg9baEeE bNJFw9y4QvAgTzaYJ91MLU7otYgHwY/bTv4NioT8hm40LEVC7kp7WQR1/OS5V/ieRrJL OKxghzXZXYBhYuOxJOBiXRZRHxtzihWM7CmdlHkriAjj2GyYWb9Fb47Jn7BF+TLrLTJx XU0wFNdYoo0+vBmc0DV6MU7CIc+wwkngGH/MsK78y8Hmtn0KP/OdX+nK+F4elBenILiQ sWbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BVDKxFA5xfnV6Ptt9fZIxDl7bZ3tyRXP9MQEQifgpG0=; b=mx+GPqRRhaFq6UW5NWdIO4nphOOg0wONGgLDPsaKQzY3x7RRv1tqV0tat8Zsrbi/w9 gr1tQ29ssE7F/lHJsempef+EeNhRbKG9QQOAwOg/ZmEMqGWbeC/ZosR1krLJTcCMNI/Y ZYOiRHxgXdoITj0vIVxI4Z/NJ3E0igwRcoKd+Y1Z7UBMEtR9H97+vqAkXKdVfhGHwBvI iHSaS+MRza3T1rBx0pBCQvcnRV/jUd8K/W8IQuqyWI5CPJobJPAg5blAeAgpKL1jaqAH W7DIDzPD9HIizsAv+AL3dDvslGCtDqC/MvSPoVOuL6su7a5Fc7qAI3ZhS8lPLs13O9Jc P5Hw== X-Gm-Message-State: APjAAAUCrhK1JAG0QjM+TpPjI5y8CPVW2/q/My785ra1ZdR8HpNhUIop fP0+WQ9W2VAllNB/Sx1wm9+pVncR0vPgiN9QT/rkvg== X-Google-Smtp-Source: APXvYqw3U5io3+nIiza+m4RgCeQXEq7t6xIcl+E7thWAHeYN+avrrzqY+qFPw3SeFy9kUdFiiiH7lbgPrKN8xg3RGlU= X-Received: by 2002:a1c:66d5:: with SMTP id a204mr3827409wmc.64.1579713252049; Wed, 22 Jan 2020 09:14:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 22 Jan 2020 18:14:00 +0100 Message-ID: To: Nicolas Grekas Cc: PHP Internals List Content-Type: multipart/alternative; boundary="0000000000003c5925059cbda7f4" Subject: Re: [PHP-DEV] [RFC] Adding a "Stringable" interface to PHP 8 From: kontakt@beberlei.de (Benjamin Eberlei) --0000000000003c5925059cbda7f4 Content-Type: text/plain; charset="UTF-8" On Wed, Jan 22, 2020 at 4:47 PM Nicolas Grekas wrote: > 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 like the fact that you automatically add the string return type to existing methods to avoid BC break problems. Given that the engine enforces this with special code right now, i believe its a nice improvement to happen automatically. > 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 > --0000000000003c5925059cbda7f4--