Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130397 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 282DA1A00BC for ; Wed, 18 Mar 2026 20:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1773865986; bh=DFyZN1w1wwJhRuOt7BJ8gMfnHBPtqi6lrfLPFgmgA38=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=atqIOSvkC9XFcQNjOiJRA2t3hcNnqv1JOpzm9ASIUk+ajPUMMI6YbTrRr3u5cP7zz EvpwdTIZTZi26baIoRI8Ko/2sAQ3213gZfBpMy1QM60n+FXdmFodYttUBOcZWOknG1 2LZAUw2ImR1AIEEFo+gbEspmWFGnV9TiL8Zg+K5kmzRgb1PH6EZPL9Jzdm13/bPirP 3iSwR2YZsNi6fsBYoe6nzt3obR09UYxP191m44tTCA+W5AhoMm50hPH+KUF+gfldn+ gFiARywP4eZKpcgvKEyzj6hJpt+we5i2jIexEkWj6ucdtxx9dbyOA4/XtVTK183/Jx ImQ3Oe0AGIXHA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7162D18005A for ; Wed, 18 Mar 2026 20:33:05 +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,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Wed, 18 Mar 2026 20:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1773865978; bh=R5vwr78HVvGi6Sr7gAXrrFENJyilH5S9ptpdvEyie9U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=N9PZufJvMGa8SjeYvQq3JiV/w0Uzhnd0xGIJGH96JB6mlz5tszNevkoSXUPOfCaRT Iz5k2INOP/e+VfFwZYF7EaiPUJV+2o0eLDswyJH+UpYLUtsTTCfuRxRprF3Idu+tne 4dhV3vswsvRcJdBTw9RMoxKlE6qie4TCVRWKppi85AplSleqlUVfW5rd0fQ9PK/t5R /E08pvhnE1elg9v2V+xI8UiD7pb27rJcPSXHbiHWxjxm64AU6ckD/tIWc4RMgIpJ1V v+/Kt+wyMenVEqVAS8rU1TV8blN8diemxTwSjUuoNGn/gkSmuEHpzOItrR2n/ZexCE Jtlh3FkfgV5pw== Message-ID: Date: Wed, 18 Mar 2026 21:32:56 +0100 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] [VOTE] enum SortDirection To: Levi Morrison Cc: php internals References: <1f2191653ca5b8c0d9411cccfb9fc9f9@bastelstu.be> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 3/18/26 19:38, Levi Morrison wrote: > Tim, I am curious if adding a backing value in a future release would > be considered a breaking change or not, something like: > > enum SortDirection { > case Ascending = 1; > case Descending = -1; > } > > The exact values don't matter for my question, only whether or not it > would be considered a backwards compatibility break. That's complicated to answer. From a LSP POV changing a UnitEnum to a BackedEnum is just “adding new things” (and indeed the BackendEnum interface extends UnitEnum), which is safe from a backwards compatibility PoV. However I've seen folks doing `instanceof` checks in the folks to decide whether to use the ->name or ->value for serialization. Changing from UnitEnum to BackedEnum would introduce a behavioral change there. All that said, I believe making an enum backed is almost always a mistake, since there is rarely a single obvious "blessed" scalar representation of an enum value, doubly so for the featured enum of this RFC, as explained by the RFC. See also the first paragraph of this email from me in another discussion thread: https://news-web.php.net/php.internals/129408 Best regards Tim Düsterhus