Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116282 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 80165 invoked from network); 20 Oct 2021 22:23:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Oct 2021 22:23:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4655E1804C5 for ; Wed, 20 Oct 2021 16:12:12 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS2639 136.143.188.0/23 X-Spam-Virus: No X-Envelope-From: Received: from sender4-of-o54.zoho.com (sender4-of-o54.zoho.com [136.143.188.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 20 Oct 2021 16:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634771529; cv=none; d=zohomail.com; s=zohoarc; b=lUmOVH6TO+wTYnRmMZCmLMF7wUkIgsDhsw7VGzSV/2Hi/ckXF2wTkPohG5UnJhgDA/x0trMc3P6Pu0fTGsYeJevYUU8O8EU8BL/7LWDBzDxm9qU3g+4db+LAXKrZ5Lz2q8u1BJs9Guph36YVOj9hkjjtF6+o6gohC85f40Q77fo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634771529; h=Content-Type:Content-Transfer-Encoding:Date:From:MIME-Version:Message-ID:Subject:To; bh=ix5VOFaNeeFX12QjndpHRuo5I70XFXyR7UgI+A61O/M=; b=SdA1imztwUuyl+ys0N9BPZEtuYVL1VPotrdXxcKHm/a4bVPKCtL7jGbMweDe+/HyucM20fSi2bjHGdH6E69FrPvcT9rJ+kXC09kB2sI8cH9xpm013Eirc+h0QAJOVB3tbffIyPAllRCIMgTySBZwJ68QPY+/VBBSZwLYW/uHkpg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=pmmp.io; spf=pass smtp.mailfrom=dktapps@pmmp.io; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1634771529; s=verify; d=pmmp.io; i=dktapps@pmmp.io; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=ix5VOFaNeeFX12QjndpHRuo5I70XFXyR7UgI+A61O/M=; b=MHaw6CZnjOb8h3IoRYciK6HK1JLRftcciiBccHeORxWJeJpbUawu4YxTs8/1nRT1 hG6ZJiVu8DvZ0H1XzvOzp/yS7lR4xH+/DdwsF5eKwTmM+BvcAJxQ4M3rs+VAwmLlWbf O8p+2YoAGAJDiPfsAMy/YNWDCvfac6peU0HSlo2w= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1634771528183685.0976754422777; Wed, 20 Oct 2021 16:12:08 -0700 (PDT) Date: Thu, 21 Oct 2021 00:12:08 +0100 To: "internals" Message-ID: <17c9ff9e9da.10b3e7f1c1280030.5141627710284677362@pmmp.io> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Subject: Add ReflectionFunctionAbstract::isAnonymous() From: dktapps@pmmp.io ("Dylan K. Taylor") Hi all, Given the addition of Closure::fromCallable() and the upcoming first-class callable syntax in 8.1, it seems slightly problematic that there's no simple way to tell by reflection if a Closure refers to an anonymous function or not. ReflectionFunctionAbstract::isClosure() (perhaps somewhat misleadingly) returns whether the closure is literally a \Closure instance, so it's not useful for this purpose. The only way to do this currently (that I know about) is to check if the name of the function contains "{closure}", which is a bit unpleasant and depends on undocumented behaviour. I'm proposing the addition of ReflectionFunctionAbstract::isAnonymous(), which would fill this use case, and may be able to offer an implementation. Thanks, Dylan Taylor.