Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124994 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 746781A00BD for ; Fri, 16 Aug 2024 19:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1723838335; bh=HXUiQfNT+eJ5sRVLZ+ni65Nsg4JLQZif9Zfz3igd+h4=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=FAzhfw2dIBlBOMBNYuJSIcqoVzPgo1g+/NAtkTXgBfWiKpghP3HkSjupTy7bVi5wW lSZQttg8HGm+gWb+iBmVNz6O7JXbjPJXz8aZ9jtl8e3cp1aAmqbhoiOfar7vNTQr7Q x2ABkZyt+A6QYplm1SEuXIepqGiUx1K7LX/vYRsXG8ZJAlgFj1SAa4Durqqy2i05UZ 0TMuqb6t8K/1Q47IuP+cSDrzEo72kKMlZRtpYYOFyvThGegkxj6vK5F3Rn5i6ili6f nOCGr1WdP3ta3FSkgc3vv6FA+nyAUc+em03Oy+WyJu34VxC1pdKLbYbu2O931Jrwo4 ezlluhLmw84FA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F0D9C180055 for ; Fri, 16 Aug 2024 19:58: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.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) (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 ; Fri, 16 Aug 2024 19:58:54 +0000 (UTC) Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-6b79293a858so12003046d6.3 for ; Fri, 16 Aug 2024 12:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coggenterprises-com.20230601.gappssmtp.com; s=20230601; t=1723838226; x=1724443026; darn=lists.php.net; h=mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=HXUiQfNT+eJ5sRVLZ+ni65Nsg4JLQZif9Zfz3igd+h4=; b=CL+74j4YPsV//2N1Ja4kOdYydqeNGGnMWBjQent8MQGO6QAnU+0w5IYhDrlArL5Jeg F5ZBxUnBVq6w/amZBJnMO4NUmur4oLnWBkAN7950BubQihiirb4Cnpwqaw0lrNobvTuc n9M0H05H0rXcZm37TyAbKlc2loc4fJFlYO35b7pojBJB8aCghVm7ipkobeIVrvXIvPPE bzaT6MBBGQQIz+ejurKg/aWwpBUoFFmssVbe0TuhXitUvkj8jMPV9vWlo7/WYOH+Jhgs toTRxYEWASGd+9EFY02SjmRrvLpLZ6EAoEKTjZh+2w5WL0bE6rNk2pQV9NnbQumf4YTD tbmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723838226; x=1724443026; h=mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HXUiQfNT+eJ5sRVLZ+ni65Nsg4JLQZif9Zfz3igd+h4=; b=YKmr437vZybTdS/X0fMiXG+jHFGsZfi8uZJ8xQiCN7ZGnQBz7zpYArAIOW6VmU0/27 Q6vWwvkcAKVQ7ro75pVPim0zonBn7IgqrH5rZUSxXAPzbY98XBNflQABTHabJYcsuO+1 OKb1L0LnVHd/ewqJTafMAKAgFCQxLJu+qq/+9Ra28HO0wyUOh8ff54e50zcKW42nAPHi +OwKNf1GZpwbWJ+Ovj6DMGGUmq260Xyvfla2X9vssTIWRSGsdkISsOez2DWcCMrpq6Eu lULWtS7B51aotQL9NPDho97WjQp05kNrIXUQGPKqJb4RXzO1/u7+Wv1d3BAZTnR3sDJ7 jooA== X-Gm-Message-State: AOJu0YxGKevXcO0lq+vzTIyVT7vvId4PatyJkG8mkq4cKg3v+PIA9DzH 2904FJpIQcMID86EzMlRtmiqbTqxKOWnuCrhHi0ITZH8i5aIX1GIME7EwBuH8pM= X-Google-Smtp-Source: AGHT+IHSkCTx99uBzDqNLDGxccfLfoyWcrrX4xzdo1noJPOEXQVupessxsg3dfzC8rDVrxuT6aFZ2Q== X-Received: by 2002:a05:6214:598c:b0:6bf:6b15:a6da with SMTP id 6a1803df08f44-6bf894e6716mr8274266d6.25.1723838226343; Fri, 16 Aug 2024 12:57:06 -0700 (PDT) Received: from Johns-MacBook-Pro-2.local ([98.97.17.118]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bf6fec5fdesm21195376d6.99.2024.08.16.12.57.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2024 12:57:05 -0700 (PDT) Date: Fri, 16 Aug 2024 15:57:04 -0400 To: Bilge Cc: "=?utf-8?Q?internals=40lists.php.net?=" Message-ID: <59BED9FD-EB77-4B44-9F93-7FC573EC7F14@getmailspring.com> In-Reply-To: <501db7d2-55e1-4b20-bb6e-1e079aa4939b@scriptfusion.com> References: <501db7d2-55e1-4b20-bb6e-1e079aa4939b@scriptfusion.com> Subject: Re: [PHP-DEV] String enums & __toString() X-Mailer: Mailspring Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="66bfaf10_327b23c6_17d67" From: john@coggeshall.org (John Coggeshall) --66bfaf10_327b23c6_17d67 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline > Didja really? > > https://wiki.php.net/rfc/auto-implement_stringable_for_string_backed_enums I swear I did. That said, looking at that RFC it's a slightly different take than what I am suggesting. This RFC suggests that string enums automatically implement Stringable . I am pointing out that it's a little silly IMO that we don't allow __toString() at all and let the developer choose if they want to implement Stringable . Looking through the PR comments it's pretty clear there was a decent amount of support for this alternative idea. It also looks like the PR for this died on the vine and I'm curious is there is any interest in reviving the discussion? I'm not seeing an obvious upside to forbidding straight out __toString() , especially (as is pointed out in the PR comments) that you can use other native interfaces like JsonSerializable without issue. --66bfaf10_327b23c6_17d67 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
I swear I did. <shame>

That said, looking= at that R=46C it's a slightly different take than what I am suggesting. = This R=46C suggests that string  enums automatically im= plement Stringable . I am pointing out that it's a litt= le silly IMO that we don't allow =5F=5FtoString()  at a= ll and let the developer choose if they want to implement Stringabl= e . Looking through the PR comments it's pretty clear there w= as a decent amount of support for this alternative idea. It also looks li= ke the PR for this died on the vine and I'm curious is there is any inter= est in reviving the discussion=3F

I'm not seeing an obviou= s upside to forbidding straight out =5F=5FtoString() , = especially (as is pointed out in the PR comments) that you can use other = native interfaces like JsonSerializable  without issue.=

--66bfaf10_327b23c6_17d67--