Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124983 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 84EB81A00B7 for ; Fri, 16 Aug 2024 15:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1723823536; bh=UloZJpoSBVjRBd5Q2rhSHfsQEl7dCaCDmplgTifUoeU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UlSnygU99fTG/qeOQecUkF3QUHlnm2zm4gVEG9kwIwdOXzNX0ZKeqAQ8flSiYGuYy Cy6H6N6ijgiKP1PEDKAQhzc2d2ezYQvpA3O6r0456zFCKHzXK8hqfTbJrWrZzPheH+ ForLuBghDj0J3My9aXn/TNIzIuQoYLlRP00TSe+lf+kA5H+NuUprAxhN7U1fPtPOgU iX2Nzz22sycbMsOPPUq80Qm4yS2PjZz8YEwjuw20kgZ95t3i9/1X+TX83hVnOnrLRg UXSQ9blFaUScBRLXQEbDlcWj+qIgedLx5f3Gw0Gtc6iBMpEvvnmzdVXLgDGjOYJNco ZkMsV3dHgjZJQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4D7AB1801DB for ; Fri, 16 Aug 2024 15:52:14 +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.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (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, 16 Aug 2024 15:52:12 +0000 (UTC) Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-691bb56eb65so21965547b3.0 for ; Fri, 16 Aug 2024 08:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scriptfusion-com.20230601.gappssmtp.com; s=20230601; t=1723823424; x=1724428224; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Svm8O2MTEznK4vwyOO2joEXtv+3rzOSD9zNSpf3SH/8=; b=hlapJfk5Iw/m9G8ZNOZKhLf5fnLwW+Opuec2czOWG1XsZOIvV2jCJYDiEoxD1T5uPR yAlzjKr29JG6QcbmiwSqnPtoDMlol+pU+wyKxHUyb7+KUOJznJhtl2SaU97mPFHmDjMS A56o9QaY3PLoP/tJRNfkHT9s+a/2xORVtmtVuIlzlackIul45JH0JKIF2Rljnor3ijsW HBobpnwyCnuNW4A+7Zz41nPSfbT0VUz1NIGgX++sKCuER1ENTNvspyxSIcrhs0Zcnhlf AKmNddtm6gv4kLpcosfY7ncYlVxIS4N4CbBSeG2Xjb3ngP+e0mAjYEJRpwgiBICwcAY3 OgXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723823424; x=1724428224; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Svm8O2MTEznK4vwyOO2joEXtv+3rzOSD9zNSpf3SH/8=; b=Xaa4I3EXCUhOPsKpGBesEHzNV2BZDxR1xFcwYTUl1l9yiery8nuRpa3piI+lQyI9iN 31+wPI85/6Gjjf+67lY2ZR0Suja/6HyaX00+1y+hawIHtJR2s0K2Eu0DiEyFoy8T9qz9 2B9MT+hqApa1BGbdUOBcuCtzN/U6Jv73fVVDba/Xhgh4aZXG62witzzJwAu1RqMg0KNv fdp7wq/wZqVIaG8xs/c8ikHWDhi9/KZsmoMjwdFxChBEJxHIA3Hnbt61zLv8Em8y+let dfpDc5LOx4PyoHv4qE3jsby1uE9mkxtoTkGcho9hy+1axuYK0HN1mnIxjnLPDgDqmVmg PYcg== X-Forwarded-Encrypted: i=1; AJvYcCWfWuPlMUZS9Jep1xDMWoeVpeuryBGHDZBdE1fDxgcNrmxPT27Rr7rpys+T2UCJ01hpjzYLwWaMAsqU3tNL3HMC9Bs3B07HYg== X-Gm-Message-State: AOJu0YwnlGpTEv8zuoANlAcOtKW9O8JLaVvIkJctsWoGRlUVLdr+ck0U FqrZKud/IsXcV8jmBUHzF/oDrWYogClT+Gi08NE+GWx1WZJFqFKHFD+kQpuIYxqOY0YZkzvMc0N uza2PryXQ/hA1yjIiAsxdiaixSH6wJcGRWFTtzg== X-Google-Smtp-Source: AGHT+IGGfibLOgS18IXsKzVR1udD0nAcTzVyjyxGWHHDxCNne4wSoPrtmgMOgcoAGk5XymVgfnC09NQW4DKfEE7hQCw= X-Received: by 2002:a05:690c:6910:b0:63c:416f:182d with SMTP id 00721157ae682-6b1b814aac9mr46033877b3.12.1723823424628; Fri, 16 Aug 2024 08:50:24 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <66BD5F05.8010409@adviesenzo.nl> <8dc51539-20bb-4017-b859-76066e2287e5@gmx.de> <6b87792b-607a-45db-bace-7175ef659024@gmx.de> In-Reply-To: <6b87792b-607a-45db-bace-7175ef659024@gmx.de> Date: Fri, 16 Aug 2024 16:50:13 +0100 Message-ID: Subject: Re: [PHP-DEV] Should there be a `get_declared_enums()` function ? To: "Christoph M. Becker" Cc: Nicolas Grekas , Juliette Reinders Folmer , PHP internals Content-Type: multipart/alternative; boundary="000000000000e1884c061fceea83" From: bilge@scriptfusion.com (Bilge) --000000000000e1884c061fceea83 Content-Type: text/plain; charset="UTF-8" On Fri, 16 Aug 2024, 16:46 Christoph M. Becker, wrote: > On 16.08.2024 at 17:11, Nicolas > > > > And here is a one liner: > > > > function get_declared_enums() { > > return array_filter(get_declared_classes(), 'enum_exists'); > > } > > Nice! > > Are you suggesting that there is no need for get_declared_enums() in the > core, since it can be implemented in userland with a single function call? > I think he just compulsively golfs inefficient PHP code (I have the same affliction). Cheers, Bilge > --000000000000e1884c061fceea83 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, 16 Aug 2024, 16:46 Christoph M. Becker, <cmbecker69@gmx.de> wrote:
On 16.08.2024 at 17:11, Nicolas=C2=A0
>
> And here is a one liner:
>
>=C2=A0 =C2=A0 =C2=A0function get_declared_enums() {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return array_filter(get_declared_cla= sses(), 'enum_exists');
>=C2=A0 =C2=A0 =C2=A0}

Nice!

Are you suggesting that there is no need for get_declared_enums() in the core, since it can be implemented in userland with a single function call?<= br>

I= think he just compulsively golfs inefficient PHP code (I have the same aff= liction).

Cheers,
<= div dir=3D"auto">Bilge=C2=A0
--000000000000e1884c061fceea83--