Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129197 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 lists.php.net (Postfix) with ESMTPS id D330D1A00BC for ; Tue, 11 Nov 2025 11:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762861451; bh=IqY1t5cYAh71u7MUofKZzvzbloIhQPYk1RU7npu1cYg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AqAYhFSM8Lk/GWcUoxFjsjqVnDOaTbvjkudt2DJ+emJ2kpRwjn5G/Pv7CN4GrJ5Y4 mj/M4NAa7UtQnRwiM05a8uY4ctdeTSygDEoWPlSSsOFztJ1sxDFRtWEK6hk/YTW49q 5lMFHJhCb78MJ0u3eqGUjpZPKsSOzxZk6mmPPe246r8jH1TX2JKGLSQcdN9qgRkYAk zUHqfEoThJ5WiGIPMOXJwGVPwQgfm+V2Cv9foKwVFZp8hOgu2OYBV4rCdjlUlUXwFE LbXmZyBKPdxroaF91m9bnCncYSWbk10zDuAxD3dW7ddEazCTILvpHeN5F9vWyJybVE lPYACGAXoD7aQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7E514180081 for ; Tue, 11 Nov 2025 11:44:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) (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 ; Tue, 11 Nov 2025 11:44:00 +0000 (UTC) Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-786572c14e3so39383007b3.2 for ; Tue, 11 Nov 2025 03:43:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762861434; x=1763466234; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IqY1t5cYAh71u7MUofKZzvzbloIhQPYk1RU7npu1cYg=; b=Nvx33+l+tnkT459Fh7eEk8lSBPiK+UQ6rnClUmxxgIbUvy7U6fAUoh6NmKMBOhEoth q0i+Z6YXSs+Ic+OqmlOQ8Nk1D3UBOREFOADKLbJJxbOEpSgT5Do1Hu7RQ9igNK6pc0Ic 5HmZaIWXDziHf32aZCOUnbrHZh1UG/7KOpTDKzGNsS3fuYGaGu/JYdLDAYF8w8/2HOmh /qKR54vMe2RHFs8yvzw+nId+TfVmNe+SsoE30XOCyRio6kX3TvIYGVl5JiqtQCbcjSFr hwSXqpnFYWPxZHlLcVl+bwNdmtEJJxVUhmS968khzHMWYuAqoGJ1k21Rts3w1w6cPs36 KwFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762861434; x=1763466234; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IqY1t5cYAh71u7MUofKZzvzbloIhQPYk1RU7npu1cYg=; b=jZ1b1GxDc5QZ1bDLNDiIdc2nCZ5ogWUp8icxaiSBsV53zON2K11xGhEq5xPEV4UPCm iwrcfknMaiDrx0xQhCckE5mnAH/V96ULMQDtomN4kNBERAS9hrwF3R0xEI7Bl+61Wrbx jeYYlmUZDFLzaLDFWRKOOwcf59aWkJyIgMjebdNg6VWtas3oQB5qjUjJBn/Zznp2Xae1 mbFgg/FkyJx0MSEWxp+P95sf1YXwL2kBjOA5y0g7lI0pUc65V8OoiOL8o4Fomp06KtWD 2iYsxVFbe0x2d5UxQKSDznAmZUgz+PRumqTTE+R0IK2kpOc6WXCe7yPCBDMSC9TsQCF+ tVAg== X-Forwarded-Encrypted: i=1; AJvYcCXx5M7tHah8KhF7/fzmaTX0SVkiP8PxJ5o3jLVtRHE9A8H/mRnFYq5IEVlGM8LI82PHt3AOfy15Y1I=@lists.php.net X-Gm-Message-State: AOJu0YypcdNXDZ8Nk24wOFRGPO12ciAKDxRLO397brL/qG+5BEd5VsAj WYqKmaGnn819jW2S+7pxxrbp55o9U2CyBlSLJ0wF8QUvOQeoxeyzvxIH1ErUdG6nIUCDoJbStC1 xmOxyIi/hx14giEVOWvV0ZxE+FW7v0wY= X-Gm-Gg: ASbGncsoPYDSQqGT6F+rDZL3BF+8E7EkFCuzgpeFmhksP+OlFblncxbjPVvx0YgeU2z YTMkFaE1bz7y+IjbfZFmOuWWIhjtWB/TTB/gXvtqE695Bk60IFFghbRK5tt0/b4+G2dM19VhW8F kytxmXHZu7evWhDghS9vrSa2L4QRK0Uqk8I1M8oer2pzAXBncUNb6bqSlQBxiXjB7pIe9p7a8TV l7hPBjbQQ6xX7RS5yZoCwSPe6qjjztfYjS2QHirYuhNdHK8hy96qpTbyd3RagX+rHz5pz/FkyjI 1M3nXa4= X-Google-Smtp-Source: AGHT+IH7sf6HYelqKZw7yjmU3nXAXGBGasbmBPbLaVrDDsNyi8pjHSUr69u5k1gC5CFCdZK4Xx6R9OIExRxWx32YFWI= X-Received: by 2002:a05:690c:8687:10b0:787:cab5:79a1 with SMTP id 00721157ae682-787d543ce2dmr102764467b3.32.1762861434154; Tue, 11 Nov 2025 03:43:54 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 11 Nov 2025 13:43:37 +0200 X-Gm-Features: AWmQ_bn9Jr7v__ppH-qgwaa0cxfePr77s4SSKfvGq-ubIXuzjk5g-y_bL4jdq20 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Add values() Method to BackedEnum To: Mikhail Savin Cc: Valentin Udaltsov , php internals Content-Type: multipart/alternative; boundary="000000000000923392064350299b" From: drealecs@gmail.com (=?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?=) --000000000000923392064350299b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Nov 11, 2025 at 10:29=E2=80=AFAM Mikhail Savin wrote: > > That said, adding values() to BackedEnum is a source-level BC break for > codebases that already define conflicting values() on backed enums. > > But, as we can see from GitHub searches that I posted in PR, most of the > implementations is exactly the same, so BC break is very small > Do you think you can quantify this BC break: how many implementations are having a different signature? And update the RFC "Impact on Ecosystem" section? Small note: implementations usually use `array_column(self::cases(), 'value')` instead of `array_map(static fn(self $c) =3D> $c->value, self::cases())`. and that's just normal, as it is 2x faster: https://3v4l.org/Q5AYg#v8.4.14 maybe mention it as well, or instead of the one you had it the examples, as this is usually how it can be found in libraries. --=20 Alex --000000000000923392064350299b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, Nov 11,= 2025 at 10:29=E2=80=AFAM Mikhail Savin <mikhail.d.savin@gmail.com> wrote:
Th= at said, adding values() to BackedEnum is a source-level BC break for codeb= ases that already define conflicting values() on backed enums.

But= , as we can see from GitHub searches that I posted in PR, most of the imple= mentations is exactly the same, so BC break is very small

Do you think you can quantify this BC break:= how many implementations are having a different signature? And update the = RFC "Impact on Ecosystem" section?

Small= note:
implementations usually use `array_column(self::cases(), &= #39;value')` instead of `array_map(static fn(self $c) =3D> $c->va= lue, self::cases())`.
and that's just normal, as it is 2x faster:=C2= =A0https://3v4l.org/Q5AYg#v8.4.1= 4
maybe mention it as well, or instead of the one you had it the exa= mples, as this is usually how it can be found in libraries.

<= /div>
--=C2=A0
Alex
--000000000000923392064350299b--