Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113426 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 8860 invoked from network); 9 Mar 2021 22:23:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Mar 2021 22:23:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7071A1804D1 for ; Tue, 9 Mar 2021 14:16:02 -0800 (PST) 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.5 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,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-Virus: No X-Envelope-From: Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 ; Tue, 9 Mar 2021 14:16:01 -0800 (PST) Received: by mail-ed1-f44.google.com with SMTP id bd6so23565496edb.10 for ; Tue, 09 Mar 2021 14:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunglas-fr.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=tb1HLcPPMvNRYtfD2AGz8qDYw28MxpxjzxkJWKDGsTA=; b=LClOsylMeN8wZ/SZf5gZPItWlYGC4M7GFABdr5f8+W8QbhhshQyq23xGmCMXJUgyg+ tXNJHmwILLe9P6/KfoyOG9thdoSv7z49oJ+e0kAr+ZGJxwSqnodVVxb0fuxWvDVje8qh cO287e2TOMU9tI0SOF2diTipKgc4WZIclDZWFjN1iqXqMMrSbwEuI6GWHjgpt5F93177 MOP0uXpa7Piunl7uhiGQ2Qui+fgkeXQbNctfqbT3OUPEvQayaqSS0TDXNJ7yBnD/jbBz UYXwJo9oD4/Sym9iuki/PIHutkjRFSgMEcuaA4158ijK4w7qE7BRWk3hR+ICHbCCQEHU S+Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=tb1HLcPPMvNRYtfD2AGz8qDYw28MxpxjzxkJWKDGsTA=; b=ErrsD8dHNPdeu9A2TVc1RuZjjg8nZ+D/jF3j6sYVHX0X3xKJGFkHVSvJzqSJmKyntD jqdHzQemgwSK4kxpjtvljcZZ9A+2zWqSFzko35Ct3UZKyb+mqEdmfQzURWti6JDnunW7 gxvCE5eap6bax7ovTe+YpnBHfUdoysgCxfBkhnWY+2LjnupxkKTHK3WGNN9AL4WtUK1i xCDjerNUbvsrWNwLKsIBQqrPllJM9zsyWANFpa9U8KmE1bGNI1zpkoQ2pTtg4MJ4f/7P ciXhYlOwrO7Olry9/3qlX3DWSF4AN0j4hdqh2TJiavSvjo93dRcTcqDTl3Knfn3/Mwsg Rm1Q== X-Gm-Message-State: AOAM5324fLVoUf4Lk9NdkMCvFhi54dxPdG7WiEtW1YJSOhdtDe/RobLe XjNrwatwLqKLER3HVQorKuB+At3S5xlCmffUrrZ3y1X1S4nNoxs7 X-Google-Smtp-Source: ABdhPJzqtxjhjJdM+8l1iwnYR0WxE7ZlwDPWStOTwukt567mlw2IKiQYccSTzs1esMEWWQ7HQ6+/I1lR6FaNLMJ3hx4= X-Received: by 2002:a05:6402:c0f:: with SMTP id co15mr6526284edb.373.1615328160414; Tue, 09 Mar 2021 14:16:00 -0800 (PST) MIME-Version: 1.0 Date: Tue, 9 Mar 2021 23:15:49 +0100 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000328d4f05bd21e56b" Subject: Add support for ::class to constant() From: kevin@dunglas.fr (=?UTF-8?Q?K=C3=A9vin_Dunglas?=) --000000000000328d4f05bd21e56b Content-Type: text/plain; charset="UTF-8" Hi folks, Currently, it's not possible to use the ::class special constant with the constant() function. This doesn't work: var_dump( constant('\DateTime::class') ); For instance, Twig's constant() helper internally uses this PHP function, consequently the following Twig template doesn't work: `myObject` contains a random object, retrieve its class: {{ constant('class', myObject) }} I wrote a patch adding support for ::class: https://github.com/php/php-src/pull/6763 As this probably qualifies as a new feature, should I write an RFC too? Cheers, --000000000000328d4f05bd21e56b--