Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119512 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 47721 invoked from network); 9 Feb 2023 16:47:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Feb 2023 16:47:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7CAC4180210 for ; Thu, 9 Feb 2023 08:47:38 -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,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 9 Feb 2023 08:47:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1675961255; bh=FBJhd+B4NBkVlf7Ir+JS0hMPgyc5up36nOBBXoktXCM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=QLLW5Ar/puBoiTHl0WYr6vZBB/uv9caVQN36rwUTfmLZmmAafCnlZWP0MqOH8Gpgv mLra85EzkXhtFX9c6KHWJ258Va0DrxH+btrTVlI+YQthuEmdoermIl9GNxFhFdPMa6 5cCCopkhuB5XjZ3ZsMjKH1+r5JBCo3O82orJuCwVcnTaEerPLLE+jDgvpVeTXnn56A 0cWoUk9UbqbnSAvKJZDVjGTDiFL0k9GTRRqcjTBSM9U9hv+OVkTymVKD/GNYlnG6Qa 0YiKofpl7eGOD4h5HUWRNVzF7ovZZxrpSYYIYX2FduRyLTAUqST2/fD+e4wRwQ+mvc ltLSMuOiwrqhg== Message-ID: <184c2812-fb4e-865c-e830-450b228e989c@bastelstu.be> Date: Thu, 9 Feb 2023 17:47:35 +0100 MIME-Version: 1.0 Content-Language: en-US To: Sergii Shymko , Rowan Tommins , "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] RFC proposal: values getter in BackedEnum From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 2/9/23 17:18, Sergii Shymko wrote: > BackedEnum::values() is much more convenient than array_column(BackedEnum::cases(), 'value'); I suspect the answer is "preference", but I have to ask: Why? Personally looking at that I find it more convenient to use an existing function that I can apply to any array or object than having to learn about a new convenience method that is a few characters shorter, but entirely specific to enums. It also raises the question why your proposal only includes BackedEnum::values() instead of also including UnitEnum::names()? I find that I seldomly have the need for backed enums in the first place. The name is sufficient to uniquely identify the case and it's also the value that is used when serialize()ing an enum. Best regards Tim Düsterhus PS: I appreciate that you follow the "no top post" rule, however I find it hard to identify the end of the quoted text and the beginning of your reply, because there is no clear separator or indicator. It also appears to break the externals.io parser [1], which is unfortunate. Is it possible for you to configure your email client to use a quote format that includes the standard '> ' prefix in quoted lines? [1] https://externals.io/message/119499#119511