Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126074 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 D3BF51A00BD for ; Wed, 27 Nov 2024 21:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732744029; bh=X5KaxxqaCv1l4j5CKa4xkCMs0pfmySrutCHcXDV6nt4=; h=Subject:To:References:From:Cc:Date:In-Reply-To:From; b=KoYA+jCmKamgGaTfms44np8Z6OweOp2lPHU0zPMXds7VN11t4680kdbAH+Jylbhmd KqICCabZJF3kBdslnDmYGVahJ/z/3y2x5AN6m2BrGN2jGOt09c5d9iP/pmTILUxjZQ a/Rw/00xLgSB8nfo+aNxsbUsfROUReb6EEwbM+bxPtSwnPWCut2vFK44PfrPKG4N75 ysKpWvJ8d+2F1E8inzdSAjiaBPv5gThKd39sO48tCAVpdNZjw769ap3FrBA/Pw3gvc dv/LDc2YWAcRWcIBIcm3PrjX56AAaIRWFKQBxIHH1DJy9OBDNQ3L5ed/sHUY8f1byt IdOpATVAfvOzQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ED399180071 for ; Wed, 27 Nov 2024 21:47:07 +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.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_MESSAGE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from caracal.birch.relay.mailchannels.net (caracal.birch.relay.mailchannels.net [23.83.209.30]) (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 ; Wed, 27 Nov 2024 21:47: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 517BEC3723 for ; Wed, 27 Nov 2024 21:50:16 +0000 (UTC) Received: from nl1-ss105.a2hosting.com (trex-14.trex.outbound.svc.cluster.local [100.118.31.163]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 91124C484C for ; Wed, 27 Nov 2024 21:50:15 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1732744215; a=rsa-sha256; cv=none; b=nmChk5ZTN3LxSFBNhIw0Ma5yqRwYioWb1lDZMumlnnCX2SR37XAkPdT0KGrEm1ZY8qcocu /Bb/eqZ57CZFGKaHC0/i8ux0CC64oWow44yOohkLXgXLYjzdrVsyVdJe3/U6popBLIlPww T60uxRoYg+4MLjWEzDqfEpyg7qbfhF0OCZI76uqT9ZVtXVc3MB+uSG/hYYefFLdt/SMWNq hZ8LX/JsJ+XFr0kV9rBNyRnIOm/P30ssFUfoOzjQutJIjQ0b21ejHupdlIe/UgL+toQiIs UowIQwJqEEYnUljszGpjwc0BZcZSggGDO+AnEpvGqrpajTDa02Hg8Xftmqc1Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1732744215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tfN4KBM6ojg3LfyKjSCKXVL3EgfroFiJkMbI7yuIXoo=; b=X+7C63QakKMrQQ0HuwQoE81d8qBbk6u3aLlpht+czgTcQXW0F/DS4AS+uRhepSbPlOLBDD rQj3hydIcOTOR3gQJNSvTFhyF2q54Q0dK03TVL97YFK7hEAcSSOIP3AGntJ2I6aRJzDDMZ 9Dh05dwHho6zvYXxREdJWvj0OHEly0800cR6syvxyALIGb5rzmPIqnClhjdpBFhY/yKe7H 7K/j/zhb0D/vDDCbGLy3gSGTarv7U0m2fYYaH9qWIIIszAtmnxkq00oABv/JnCIZxvovcu fjMNTRYlNfRtLvNrmO9lEC16n9v/e//UfsclclgOih+/od+sC691vPzqZsYs+A== ARC-Authentication-Results: i=1; rspamd-868968d99d-xdvj9; 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-Drop-Invention: 55fe52d7312bac37_1732744216098_1859483282 X-MC-Loop-Signature: 1732744216098:498725223 X-MC-Ingress-Time: 1732744216097 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.118.31.163 (trex/7.0.2); Wed, 27 Nov 2024 21:50:16 +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:Cc:From:References:To:Subject:Sender:Reply-To: 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=tfN4KBM6ojg3LfyKjSCKXVL3EgfroFiJkMbI7yuIXoo=; b=iPUc/v8es3pADRy4rvcAZOgS/e ziZBudTGNds4t7nDMmedvPeI44AJ9uLZpgR1Y3DzUmcOTvBTDIWKqFUJa7ZjYTqrv3wM8rETOf585 BEJW3Auz44jlLUHeMfhUnn/2l+26JfzmVL1o7Kl+KxFjzPXZfs0wnKAMrDhTAqj2RLPs=; Received: from mailnull by nl1-ss105.a2hosting.com with spam-scanner (Exim 4.98) (envelope-from ) id 1tGPvJ-0000000AwTR-3ZS2 for internals@lists.php.net; Wed, 27 Nov 2024 22:50:13 +0100 X-ImunifyEmail-Filter-Info: UkNWRF9WSUFfU01UUF9BVVRIIElFX1ZMX0JVUlNUX0FDQ09V TlRfMDJ EIFJDVkRfVExTX0FMTCBJRV9WTF9CVVJTVF9BQ0NPVU5UXzAwRCBWRV JJTE9DS19DQiBNSURfUkhTX01BVENIX0ZST00gQkFZRVNfSEFNIEZST 01fRVFfRU5WRlJPTSBUT19NQVRDSF9FTlZSQ1BUX1NPTUUgQVJDX05B IFJDUFRfQ09VTlRfVEhSRUUgVE9fRE5fU09NRSBGUk9NX0hBU19ETiB NSU1FX1RSQUNFIFJDVkRfQ09VTlRfT05FIElFX1ZMX1BCTF9BQ0NPVU 5UXzAxIEFTTiBfRFJVR1NfTU1fRElTQ09VTlQgTUlNRV9VTktOT1dO X-ImunifyEmail-Filter-Action: no action X-ImunifyEmail-Filter-Score: 1.11 X-ImunifyEmail-Filter-Version: 3.8.7/202411271014 Received: from [31.201.40.213] (port=58444 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.98) (envelope-from ) id 1tGPvK-0000000AwSV-1KMt; Wed, 27 Nov 2024 22:50:13 +0100 Subject: Re: [PHP-DEV] [VOTE] Support Closures in constant expressions To: internals@lists.php.net References: <6a1940027c8c534e62bfb13d222947bf@bastelstu.be> Cc: =?UTF-8?Q?Tim_D=c3=bcsterhus?= , volker@tideways-gmbh.com Message-ID: <67479414.8070302@adviesenzo.nl> Date: Wed, 27 Nov 2024 22:50:12 +0100 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: <6a1940027c8c534e62bfb13d222947bf@bastelstu.be> Content-Type: multipart/alternative; boundary="------------070803000907020501090904" X-AuthUser: juliette@adviesenzo.nl From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) This is a multi-part message in MIME format. --------------070803000907020501090904 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 27-11-2024 15:03, Tim Düsterhus wrote: > Hi > > Am 2024-11-13 14:40, schrieb Tim Düsterhus: >> we just started the vote the the "Support Closures in constant >> expressions" RFC. Please find the following resources for your >> reference: >> >> RFC: https://wiki.php.net/rfc/closures_in_const_expr >> Implementation: https://github.com/php/php-src/pull/16458 >> Discussion: https://externals.io/message/125872 >> >> The vote will end in two weeks, on November, 27th 2024 at 14:00 UTC. > > Voting just closed. The RFC was accepted unanimously with 19 (Yes) to > 0 (No) votes. Thank you for your participation. > > Best regards > Tim Düsterhus > Congrats on the passed RFC! Sounds like a useful feature. One thing I'm wondering about - and of which I saw no mention in the RFC nor in the preceding discussion - knowing that function names are case-insensitive, how is ambiguity handled when _calling_ a callback stored in a (class) constant ? Consider the following code sample: const STRTOUPPER = static function (string $text): string { return $text !== '' ? \strtoupper($text) : ''; }; STRTOUPPER('test'); // What will this do ? Call the PHP native function or the closure ? And what about this one ? class Foo { public const STRTOUPPER = static function (string $text): string { return $text !== '' ? \strtoupper($text) : ''; }; public function strtoupper(string $text) { return \ucfirst($text); } public function test() { self::STRTOUPPER('test'); // What will this do ? } } Foo::STRTOUPPER('test'); // What will this do ? Curious for your reply. Smile, Juliette --------------070803000907020501090904 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 27-11-2024 15:03, Tim Düsterhus wrote:
Hi

Am 2024-11-13 14:40, schrieb Tim Düsterhus:
we just started the vote the the "Support Closures in constant expressions" RFC. Please find the following resources for your reference:

RFC: https://wiki.php.net/rfc/closures_in_const_expr
Implementation: https://github.com/php/php-src/pull/16458
Discussion: https://externals.io/message/125872

The vote will end in two weeks, on November, 27th 2024 at 14:00 UTC.

Voting just closed. The RFC was accepted unanimously with 19 (Yes) to 0 (No) votes. Thank you for your participation.

Best regards
Tim Düsterhus


Congrats on the passed RFC! Sounds like a useful feature.

One thing I'm wondering about - and of which I saw no mention in the RFC nor in the preceding discussion - knowing that function names are case-insensitive, how is ambiguity handled when _calling_ a callback stored in a (class) constant ?

Consider the following code sample:

const STRTOUPPER = static function (string $text): string {
     return $text !== '' ? \strtoupper($text) : '';
};

STRTOUPPER('test'); // What will this do ? Call the PHP native function or the closure ?


And what about this one ?

class Foo {
    public const STRTOUPPER = static function (string $text): string {
         return $text !== '' ? \strtoupper($text) : '';
    };

    public function strtoupper(string $text) {
        return \ucfirst($text);
    }
   
    public function test() {
        self::STRTOUPPER('test'); // What will this do ?
    }
}

Foo::STRTOUPPER('test'); // What will this do ?


Curious for your reply.

Smile,
Juliette
--------------070803000907020501090904--