Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124941 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 DDCBC1A00B7 for ; Thu, 15 Aug 2024 13:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1723727518; bh=Ika9TQz6g+G14lbpElT4WmcKd5vpzUMmde0tQYuOZmo=; h=Date:From:To:In-Reply-To:References:Subject:From; b=dWkjy70mGxY4/MAlEOsyKJE/UILB7bGFNlTwFi7IFgqnqCA4LWN1gBxI+rX1+KF6s ft1YuKtrqC0oNNDOGevzRVZyZVbhA4E+XAsbdxNjXPr2t1LJ5xjjaW/gR2MVHkM/zc OwF/w5w2oLcawcommwz6jPhmehj9KzDfEsD5PHXKyH0L78KyAtxv69aKABR6XaEKZx NY/XlxZt1hJPW6731mjsFIvjNcz/PVXfhjbw3dgdz/OqL9GM4bn9wyYYq1iYnKJWvi u2Dj3Z8JykhiL64YQ1RMPwfBCdjEhzO/LpW/VuGJbubPZxcAdQATYj+32bMPNWSQQr uEE+ltgeBm1mA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2C7A118006D for ; Thu, 15 Aug 2024 13:11:57 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh5-smtp.messagingengine.com (fhigh5-smtp.messagingengine.com [103.168.172.156]) (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 ; Thu, 15 Aug 2024 13:11:56 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.nyi.internal [10.202.2.43]) by mailfhigh.nyi.internal (Postfix) with ESMTP id A28981151CEA for ; Thu, 15 Aug 2024 09:10:09 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-03.internal (MEProxy); Thu, 15 Aug 2024 09:10:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1723727409; x=1723813809; bh=qh0pzfIZgYHyKiElYRImL Ac9zoIQcigymzPd3lcLn+Y=; b=cuAN8p/Ny8hn7uKQGg4kUSy2pmf3sm49AW8ui KojMmm/ye8joQbwQuo/A+FAmYNZeeNpYiq42Yi3acJeCb3DhsJ/8tzP6Zli8prrd qt5GIFynfKdrvf3tVM7J6wU4rAQ8eG9T+zWf0XyP7PwRDlubZo6blKVKDfxDtj/n uWwEobpz4L9slq7qPLM5/RDYqIdkDOYmEh6nGcN5rKbkzFVXJ17lV9Z6wjy4ZvaM 6cksJoJStACvKue8Qllk3B1+oMsOro6dPoPATWKOzWCIPF5amD9nNgsVRaIU+0vx 2cBCIKYNc0CJfDsFeYn/Rx5ZuaCvlAtvn2D4K8ScrQXG80D3w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1723727409; x= 1723813809; bh=qh0pzfIZgYHyKiElYRImLAc9zoIQcigymzPd3lcLn+Y=; b=q R4bbpY3/2BUTsETvfCEhSuluV4T0VYWBqu3gQBXpMAkAXRjQPmlo8DnNRHS3jhaV ra2UGi5P4O2F+hmUUY/kwi96Tcwrzt52yBEAkTB8oKukGVh+AwrnCcoRhBN4eZ/f sIRgQhc2sFvsk9xFcdFd/euB0HBIdyxCDG2uhNcqsunORVPOaTFSrsQUlWdhViaM v7CctbqtkRq2z/BtvC3LQ7ueBcpgINgByw/gBcgRFAv7RwP9VHjnYnJ8EC9V3M0g Cmlaq/e5CKZa5J4MTYn7kH8pKEAlmRR/IhEm28O9ch/+lvo5MDqA+G+nuLM6r2Yz bpC+v4dXijnN13Q/pCFrA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddtiedgiedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegoufhushhpvggtthffohhmrghinhculdegledmnecujfgurhep ofggfffhvffkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfnrghrrhihucfirg hrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqeenucgg tffrrghtthgvrhhnpeffgeekheehjeffvedvleehfedtveehffeiheejkedvkefhgfduhf efvedvfeehheenucffohhmrghinhepfehvgehlrdhorhhgpdhphhhprdhnvghtnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesgh grrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhm thhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvg ht X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 4083694005E; Thu, 15 Aug 2024 09:10:09 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 15 Aug 2024 08:09:49 -0500 To: "php internals" Message-ID: <87fc9033-b0cc-423a-bcb6-8cef287a8ee6@app.fastmail.com> In-Reply-To: <66BD5F05.8010409@adviesenzo.nl> References: <66BD5F05.8010409@adviesenzo.nl> Subject: Re: [PHP-DEV] Should there be a `get_declared_enums()` function ? Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Wed, Aug 14, 2024, at 8:51 PM, Juliette Reinders Folmer wrote: > L.S., > > I just noticed the following, which struck me as weird/inconsistent: > > There are four different OO structures in PHP: > 1. Classes > 2. Interfaces > 3. Traits > 4. Enums > > For all four, an `*_exists()` function is available, i.e. > `class_exists()`, `interface_exists()`, `trait_exists()` and > `enum_exists()` [2]. > > But only for three out of the four, a `get_declared_*()` function > exists. > There is `get_declared_classes()`, `get_declared_interfaces()`, > `get_declared_traits()`, but no `get_declared_enums()` [2]. > > I'm aware that enums are internally considered classes and that > `get_declared_classes()` will retrieve them [1], but the same could be > said about interfaces and traits, yet they do have their own > `get_declared_*()` function. > > Should a `get_declared_enums()` function be added ? > And should the `get_declared_classes()` function be adjusted to exclude enums ? > > I did check the enum RFC [3], but I couldn't find any mention or > discussion about this in the RFC. > > Smile, > Juliette > > > 1: https://3v4l.org/0ub6I > 2: https://www.php.net/manual/en/ref.classobj.php > 3: https://wiki.php.net/rfc/enumerations Conext: I can't remember the last time I used get_declared_classes() (thanks to autoloading and class_exists() it's a kinda pointless function), so when we were working on enums it never occurred to us to think about it. It wasn't a deliberate decision to omit, as far as I recall. I think I'd be open to adding it; my concern would be the overlap with get_declared_classes(), which as you note currently would include enums, and changing that is a BC break (even if a tiny one that I doubt would impact anyone). --Larry Garfield