Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116283 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 3597 invoked from network); 21 Oct 2021 06:56:36 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Oct 2021 06:56:36 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6FF56180381 for ; Thu, 21 Oct 2021 00:45:00 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, 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: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 21 Oct 2021 00:45:00 -0700 (PDT) Received: by mail-ed1-f45.google.com with SMTP id a25so1518837edx.8 for ; Thu, 21 Oct 2021 00:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zfIWimdz/gCQ4TzIVnIO82pdlcIIGcel7Rmv9x05kqI=; b=nGbbfrI0lhHePCcSZfrnbQwXqGQfPKQJhVJFyoZFuiF7UBTplnPVmG5hXdYOY630wU Ucu9gzRvtyiU5wVjglPPCyPw8JUgwM0lrn0cEongh7jFQtnpenvKaAH+ztaVY3ie4Beb fcKjlFIf2pUSi3UJ5ME3cktA5HecvvlmIRQX2jqbaZ+Em8nmTT+BserVA7ot+DXqw2yj TJA5K2LBJYGgNWYBICHAsgNQjVtBceu22wENKIZEnGUlFu+xQ7OV0aw5XMy8SpkYwBrM FF5nymI/+DIEEJPDN6ATvlm+aqrG1Ib6AgNX5dowK3M4dVjLFTXu0Bce2+7wF2ocJkb+ bBrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zfIWimdz/gCQ4TzIVnIO82pdlcIIGcel7Rmv9x05kqI=; b=FJPlrqAYzHi64GQylypHbIxWaZZriFo7VY0dK1qhU6ws+K48pXqy8peavBCW7jgqAF GVuLUSMhnFDxlft5rUoruJv8pJn5phDaHd2entgM463WOXUOB0NGptOkqvLoCPpYR3nt aHqFDKlZnxu/qnxfVHPxviuv+qDjV+UO4Y/8T7rUJsMUOmwqcJiuKFwuEpDYXhddW6G/ 8JlVa5zyNz2EXBbX4MfGylwIkrhe9uUTPWrhbgarMURR+j2KsSs58ZYBILWT+CyiR+Qd MnCbKZaAYKnYkatc2UAYuVexDK495qFJ3vPxPdqH1CE56LODbPQ4+iS1hrB8xfVF3Jpk L4aA== X-Gm-Message-State: AOAM533Xl63tRtA1CvJF16oDorhYEm0Y6y53KCZJyLOhSdxAaIv4605h FJ1+KRaaTKrxGGSjhe8i+bER0zclSteYAxyx7jDA5QMy X-Google-Smtp-Source: ABdhPJx/uKmMr748q6xilLw4Qu4g4yoVAeumu6vLVSbY4Y/2pYxDG27Td284FAkpJxnuc19sm7XfShTRAmeCaC3fnlQ= X-Received: by 2002:a17:906:e104:: with SMTP id gj4mr5179203ejb.358.1634802298834; Thu, 21 Oct 2021 00:44:58 -0700 (PDT) MIME-Version: 1.0 References: <17c9ff9e9da.10b3e7f1c1280030.5141627710284677362@pmmp.io> In-Reply-To: <17c9ff9e9da.10b3e7f1c1280030.5141627710284677362@pmmp.io> Date: Thu, 21 Oct 2021 09:44:42 +0200 Message-ID: To: "Dylan K. Taylor" Cc: internals Content-Type: multipart/alternative; boundary="0000000000004cd10305ced812ba" Subject: Re: [PHP-DEV] Add ReflectionFunctionAbstract::isAnonymous() From: nikita.ppv@gmail.com (Nikita Popov) --0000000000004cd10305ced812ba Content-Type: text/plain; charset="UTF-8" On Thu, Oct 21, 2021 at 1:12 AM Dylan K. Taylor wrote: > 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. > Sounds reasonable to me! Nikita --0000000000004cd10305ced812ba--