Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125046 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 CC0A71A00BD for ; Mon, 19 Aug 2024 14:29:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724077870; bh=CbspXNXwATFxPY5SWzxrFWvfRHBSRhXAnF11dru285I=; h=Subject:To:References:From:Date:In-Reply-To:From; b=EKiv7mVhIkIPEQC9rNF2Ghyxl/G5Tgv9hXSWmc3bhCSeVK0v2h368ze2WaUEHHKNW uJdFw7M4vfcNoL8DZRPV4QwjcHDVvnvXxjJivJ/PoCfciKqD+ure09MqLuALrni0zP IxdU0j3h1S8NlB4wRfwznV4/yGAiFywUlJHlcWM5TsytI1l0nIPdQfwUNSW9Dz04E3 7YQ7pvqjfk35K7uKPyKjrnDl3Qqr9gOeR7rbDeTBSBwn+vzWkzEGRp6dhcdz62Te/5 2znSVE838N1wtZpewzrKXr6jWL3gM8VotE0NAqlvMM3h/gvqXf+j/StkoXh9tX9bqD Y+VFZYmmARB1Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2FE1A180068 for ; Mon, 19 Aug 2024 14:31:09 +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.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_MESSAGE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_SOFTFAIL,STOX_BOUND_090909_B autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from giraffe.ash.relay.mailchannels.net (giraffe.ash.relay.mailchannels.net [23.83.222.69]) (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 ; Mon, 19 Aug 2024 14:31:07 +0000 (UTC) X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 018E1145017 for ; Mon, 19 Aug 2024 14:29:18 +0000 (UTC) Received: from nl1-ss105.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 45CBB147310 for ; Mon, 19 Aug 2024 14:29:17 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1724077757; a=rsa-sha256; cv=none; b=zyAK113N6aLMY79Mv8ymHrdjheu8vC8CXSPVhtkSHW467k86l3KP0xPl3zwCNfvWuMR1RV 5U3Xq7biKsWy9zKw0di2fNF8Pf2haHNnOsX3frkLvyqWib2lTApkaYObQahud8lKZ7bYMm LXPlnChZtBbbXU5a38Ol+rLm6O8oJm/81rRH+QL/RnlYJ0mfz7NKiT1DwcIQmT0Bfj1XVV hvbOsmgZN2661+yYuL2gumgXlByA48wAmpfjmsfqQiA8YN5wUlImMAcIVDjPW+70ta+8s/ MJ3Ru7/uiRKg2sGsvdOHOVfJlEFotb0FsvNpDbihb9CPzSqeIHzDDf+zNPXKRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1724077757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=P4rXzwYAlJtw0AzfK+eGuaLVdD/Dj15k9y3c0v9ftY4=; b=kILWAS/NtxFxd4wjBWI1Miz5sSbrxDG9iH6Xjap6ku79xp1I5KS7UG+hul9kh6yVZHklVC dYIiGDSfH/TnlKOtkMpqY0LGCgYkSvrQn3+CKBef1tPOC4uOyZBval5kdx985QjfxdR19Q lVOzFmMHhuOVJmobRoVuRNgbe3tzbsGV5HcHhwaz1XBHfLklhMcJJas7D1T5xEZjHT6skQ /PE5aQC8J4FRbW5g00xb6Yr0SdKr/gOGp7ug5CqrvSFETytHTB5S6nhZe/SdLyNXcpSiiV 5Mg3fVzx0eRmCrjDeWYlKW5sHgl4XZxZEqww85p9f5mfwGDW4GbASkUF1Y3+8w== ARC-Authentication-Results: i=1; rspamd-587694846-nzn6j; auth=pass smtp.auth=a2hosting smtp.mailfrom=php-internals_nospam@adviesenzo.nl X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|juliette@adviesenzo.nl X-MailChannels-Auth-Id: a2hosting X-Belong-Left: 4dc04d201b5b2d69_1724077757815_3443601562 X-MC-Loop-Signature: 1724077757815:2108547888 X-MC-Ingress-Time: 1724077757815 Received: from nl1-ss105.a2hosting.com (nl1-ss105.a2hosting.com [85.187.142.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.98.197.226 (trex/7.0.2); Mon, 19 Aug 2024 14:29:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=adviesenzo.nl; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=P4rXzwYAlJtw0AzfK+eGuaLVdD/Dj15k9y3c0v9ftY4=; b=lwtPD7lC+MFh1wRa8cd74Pz0d3 iRi5kL3Nb8rsSe+RKUNhh+xb6qg1AQIXckacHXQjSIyrAQmBe1L6o6r9wo/XOJjnbj9OuzHx11pt6 yi7G2QLEQZq1LoGEcUvqk46daXNwZvmMZ/13BPWOQ7UCTk3B4ZkyHRpVamXIC2cank1o=; Received: from mailnull by nl1-ss105.a2hosting.com with spam-scanner (Exim 4.97.1) (envelope-from ) id 1sg3Nj-00000007kGM-1hIz for internals@lists.php.net; Mon, 19 Aug 2024 16:29:15 +0200 X-ImunifyEmail-Filter-Info: UkNWRF9WSUFfU01UUF9BVVRIIFJDVkRfVExTX0FMTCBTVUJK RUNUX0V ORFNfUVVFU1RJT04gVkVSSUxPQ0tfQ0IgTUlEX1JIU19NQVRDSF9GUk 9NIEJBWUVTX0hBTSBGUk9NX0VRX0VOVkZST00gQVNOIE1JTUVfVFJBQ 0UgUkNWRF9DT1VOVF9PTkUgRlJPTV9IQVNfRE4gVE9fRE5fTk9ORSBS Q1BUX0NPVU5UX09ORSBJRV9WTF9QQkxfQUNDT1VOVF8wMSBUT19NQVR DSF9FTlZSQ1BUX0FMTCBBUkNfTkEgTUlNRV9VTktOT1dO X-ImunifyEmail-Filter-Action: no action X-ImunifyEmail-Filter-Score: 1.52 X-ImunifyEmail-Filter-Version: 3.8.4/202408161000 Received: from [31.201.40.213] (port=65530 helo=[192.168.1.16]) by nl1-ss105.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.97.1) (envelope-from ) id 1sg3Nk-00000007kG6-14b0 for internals@lists.php.net; Mon, 19 Aug 2024 16:29:15 +0200 Subject: Re: [PHP-DEV] Should there be a `get_declared_enums()` function ? To: internals@lists.php.net References: <66BD5F05.8010409@adviesenzo.nl> Message-ID: <66C356A3.7010603@adviesenzo.nl> Date: Mon, 19 Aug 2024 16:28:51 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 In-Reply-To: <66BD5F05.8010409@adviesenzo.nl> Content-Type: multipart/alternative; boundary="------------070805040908000509070802" X-AuthUser: juliette@adviesenzo.nl From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) This is a multi-part message in MIME format. --------------070805040908000509070802 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 15-8-2024 3:51, 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 > Not responding to anyone in particular, but just letting you all know that Ayesh and me will work up an RFC for this. I will email the list when we've published it to open the official discussion period. Smile, Juliette --------------070805040908000509070802 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit
On 15-8-2024 3:51, 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



Not responding to anyone in particular, but just letting you all know that Ayesh and me will work up an RFC for this.

I will email the list when we've published it to open the official discussion period.

Smile,
Juliette
--------------070805040908000509070802--