Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124937 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 428BA1A00B7 for ; Thu, 15 Aug 2024 01:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1723686800; bh=3vtR/7PeHfCajK5azZDCtAm6wP+VJ5Mb/hpn7jhZL60=; h=To:From:Subject:Date:From; b=PEHVm2OgGtQRTLE+mm/GijvNom5uXTtuatwciwAodb87cazyXaY3yxRTJBdmY8m7A c8D3VvZuc3e7jqe86zH+0t4FiUcX1RjvkR5HYpNTagOyTyz/bNcYvfdVtppM3Ix5WG eMuEWsCFWXX9cesiK+rezPr/Ziq2fIPQ3HCmD4bjGoctE6bQIXTn2mxjFVBTLyfBxu 8NaQvTtX85g/kLeeg/Hlf8hWQcwHjl3OMepdxJZlk3Qy7r2mwbKRsat3urlvWG5iJ+ o9oSTkKXP7PqZ9BXMSFWsBYvkcf+pqLhndUzE62SASf++AB+I/Nblyznv7fpXXDVr/ KS5y2dUJLfZyA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 15B7F18006F for ; Thu, 15 Aug 2024 01:53:19 +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=2.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_40, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from egyptian.ash.relay.mailchannels.net (egyptian.ash.relay.mailchannels.net [23.83.222.56]) (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 01:53:18 +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 9A4AEC61FD for ; Thu, 15 Aug 2024 01:51:30 +0000 (UTC) Received: from nl1-ss105.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 63169C5A26 for ; Thu, 15 Aug 2024 01:51:29 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1723686689; a=rsa-sha256; cv=none; b=ahly6twsXMSk6GKQuwUa9WKnq8XSpnWuOnqFf5dbrPXgAm82qnXJemXXyV5RqGWEriOv12 v5zAzVwp2L9oCMDzl88iYhlw5/vv0/iJaVYeTdQolGe+W/zdXrlS5UHUvywsatrh8mM0i4 abSKs+IJN/gtxbw2T9ockmVKpckvhy5nxJb8ALItlbu/h/TcJd4qdWaCtYiV5RxTfnHaGP /aRZ8xpO/I0IDa+2FRqPHQhqDfGTuCdslLAMEAPq5g30wLjDNYnUE9Xec0JkGlTVs8oCdc aPVGwf69RUt5w7UX+v5QgOcmal/LqnedXOhgLjvylRBTqQav/qiCdp6d9Dcn5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1723686689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: dkim-signature; bh=dOx+i8J7nXzcfcYXef1Aam3Eax86ismdMLam3fjas5M=; b=iJ+RS5XJiqqo5CMff1dYYQNYh76BiPcbbOwol+PKVanxZD9fMOk3FA3vubS3NwHof9fAq3 NpKDEfBMTd/im4WdnL8L8xBNwGUbIczM2D6CiqH2IUjXvarTcUf4S1DKqSmAFghLf8ZTjm p3NgdtOZ8L6vwUaQ/DRuklCNILZYC4F/qjKqMynhl01JDdTNEp/Gv5GOHvOhEryVlhrtGp Ofluj59oRL6ybGNNS/QoKl4QsGjTcnq/jeRcHG2WoNQ/sWMBA0D7FWiRNt5obDVPZppA/r CAS9xxXma5jfoMlWf6XqDyLkrPOqHH7J7rPFM/zb5mIe9Fz2A6aSVq4x+b/0Ig== ARC-Authentication-Results: i=1; rspamd-587694846-g59mf; 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-Eight-Wiry: 1ee2ee544ed43d6d_1723686689917_4135003798 X-MC-Loop-Signature: 1723686689917:1098681034 X-MC-Ingress-Time: 1723686689916 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.111.125.119 (trex/7.0.2); Thu, 15 Aug 2024 01:51:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=adviesenzo.nl; s=default; h=Content-Type:MIME-Version:Date:Message-ID: Subject:From:To:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dOx+i8J7nXzcfcYXef1Aam3Eax86ismdMLam3fjas5M=; b=A8pVrYkB8KjVTDg6zpmMg2KczZ 0fkT7bCxkvlbW3cE10sI/TgiXeUDnDjgqK5CMpqfeGTj74rj3GEvkWY1zpCGKbvrfL0/1CAjvOMWR rq2JfdeaG1HEoQ0sCFQZkbzdaaUC3Jk5BVPOXw6c3pV4QGFiOLMOR9BrJAWe0VlHpns0=; Received: from mailnull by nl1-ss105.a2hosting.com with spam-scanner (Exim 4.97.1) (envelope-from ) id 1sePeB-00000002r0W-2hEt for internals@lists.php.net; Thu, 15 Aug 2024 03:51:27 +0200 X-ImunifyEmail-Filter-Info: VE9fRE5fQUxMIFJDVkRfVklBX1NNVFBfQVVUSCBSQ1ZEX1RM U19BTEw gU1VCSkVDVF9FTkRTX1FVRVNUSU9OIFZFUklMT0NLX0NCIE1JRF9SSF NfTUFUQ0hfRlJPTSBCQVlFU19IQU0gRlJPTV9FUV9FTlZGUk9NIEFTT iBNSU1FX1RSQUNFIEZST01fSEFTX0ROIFJDVkRfQ09VTlRfT05FIFJD UFRfQ09VTlRfT05FIElFX1ZMX1BCTF9BQ0NPVU5UXzAxIFRPX01BVEN IX0VOVlJDUFRfQUxMIEFSQ19OQSBNSU1FX1VOS05PV04= X-ImunifyEmail-Filter-Action: no action X-ImunifyEmail-Filter-Score: 0.62 X-ImunifyEmail-Filter-Version: 3.8.4/202408121450 Received: from [31.201.40.213] (port=51965 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 1sePeB-00000002r0I-2921 for internals@lists.php.net; Thu, 15 Aug 2024 03:51:27 +0200 To: PHP internals Subject: [PHP-DEV] Should there be a `get_declared_enums()` function ? Message-ID: <66BD5F05.8010409@adviesenzo.nl> Date: Thu, 15 Aug 2024 03:51:01 +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 Content-Type: multipart/alternative; boundary="------------020502060000080606000401" X-AuthUser: juliette@adviesenzo.nl From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) This is a multi-part message in MIME format. --------------020502060000080606000401 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 --------------020502060000080606000401 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit 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

--------------020502060000080606000401--