Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125747 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 1508D1A00BD for ; Fri, 4 Oct 2024 14:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1728051510; bh=7YUxHVEKzfBWi3hOHXfJcpInEsdsTtKiXwgSBt7Bmxg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Zzf4h381Ye13juV9wfEhJo+jlgQYHDaremnbV41nMlEOQ2jw5ybAKnkvhgBDuPCqN 5JiHXplGHZL9z20pXfTMmXO0nDDngXsEtND1RR+Sz99X7xjWvchpZ2yZj3p6GyIVPO l+5Zip+49YDplmmnRwwsNkPAKNQeY5pM9KDEJyPO4xtjogw/SCzZAmk6MgV1VZTIdB t9eRhLGavLux9Fxaz9I3wWqLhKd36VPq7RLm0XHCmZ5IdHeV1GIjxLEStaSWvSG/tO 2OSnVFIrX/ebTX9JLW6/WkpeQ8CY1QqgR4iShG7/K2JcKUZlcsyLk1x0oDzdt/JrX0 v1DE9h0QbikYw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1A78E18007A for ; Fri, 4 Oct 2024 14:18:29 +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.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.0 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 ; Fri, 4 Oct 2024 14:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1728051373; bh=b5WgRP3CRcB++lPadwkiEfREq0JdurVi3gX4rYBV6Qw=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=T4kSuvwo5yaea7Omli2G5D08Dfr/LuebQnOVNg8Q03k8+dfjwUrEbaXhueuAQVTtR NGjzybpE1C/6EZonosi27T2Po7PvzgZu7mzgTCgk7h0yUrOW/wEEyP2ULv/CfGWvg0 6fQ9L+Ry7y7+5f3JWQzx64Un8Vrv7IyVvkA30o1vQuzM2RhG9Xn9GK2Mw0t4yDt+zb b7S0JZ5NHoVkR4MRC//ZXS/KaxRM9u6g7gJqe4/Zg7t4OZPl/EeuUn51Rwt54idQSL Uic1QUMhZblG3GvNtzKW0XZq500yaW6Cm2IpeZ2ococrbh2e+Popnhhs+aLldOQyJu Q37caCaMPwfdg== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 04 Oct 2024 16:16:13 +0200 To: Nicolas Grekas Cc: Juliette Reinders Folmer , PHP internals , Ayesh Karunaratne Subject: Re: [PHP-DEV] [RFC] [Discussion] Add get_declared_enums() function In-Reply-To: References: <66FC7B9F.5070906@adviesenzo.nl> Message-ID: <80dfd8f02a4921d4772ec3c44cdbedff@bastelstu.be> 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 Am 2024-10-04 13:44, schrieb Nicolas Grekas: > # Introduction of the new function: get_declared_enums() > > About this proposal, I shared a one-liner in the previous thread that > shows > listing only enums is trivial already. > IMHO we don't need this function since the engine already provides > everything one needs if they want to list enums. I won't object either, > I'm > just "-0". Agreed. > # Deprecation of using class_exists() on enum names > > This is a big NO on my side. This will break perfectly fine code for > the > sake of some high level ideas that matter less is practice than > ensuring > stability of the PHP platform. A BC break has to be worth it and this > is > clearly not the case to me. The canonical examples are checks like > `class_exists($c) || interface_exists($c, false) || trait_exists($c, > false)`. This is common code to check if a symbol exists in current > PHP. > Yet, with your RFC, all such checks would become broken immediately. Also agreed here. I don't think that the RFC lists particularly strong arguments in favor of the breaking change. From what I see the main argument is perceived consistency. But as can be seen in this discussion, it's possible to make the argument of consistency in both directions. I also believe that consistency is a strong argument to make before a feature is introduced to not make PHP any more inconsistent, but once the "damage is done", making *behavioral* changes would just make the damage larger. I'm specifically highlighting *behavioral* here. Deprecating something and then later removing it will very visibly break the code if one ignores the deprecation notice, but when making a behavioral change, code will instead silently misbehave. As Nicolas also mentioned this is especially true for the change to `get_declared_classes()` which would be unable to emit the deprecation notice at all! Best regards Tim Düsterhus