Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120293 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 93166 invoked from network); 15 May 2023 18:26:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 May 2023 18:26:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6AE95180382 for ; Mon, 15 May 2023 11:26:22 -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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 15 May 2023 11:26:22 -0700 (PDT) Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-39420384cc4so4107233b6e.0 for ; Mon, 15 May 2023 11:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684175181; x=1686767181; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sSjqsY93ztfzC6LcT2MU3YumnEtUwGEDFBran9U7aT8=; b=OJMSNi2jDtQE2EZk492MsKnpoTGpUdProVOAzYlp+owturhl6fwD9FcsX6qkvgXmNV bsB4LSwrhXULk3f74/3wiq8PSMB1jreWM6Wn/vyTOVwzy32xSLn22FvqrnTlZCZBBji1 HnlYT7F7JQ9gUPje40qSOapkDjlAzU0425bMQVrwjw92JR/mm0IAzuxudBSP7bGPvB2E T3OSK49hzu6cstAyqOcK32PqT63LD9qs04CxqxJFVwqG/lW4sIHk2MduiHlYeIs6fXWy 0PJyW26NFjgshjhhbEtO1zQ7FJV1A5GJEKygqKNFVeqDFOrFAP47wQtGOT7tH2FwM7vv 63EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684175181; x=1686767181; h=content-transfer-encoding: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=sSjqsY93ztfzC6LcT2MU3YumnEtUwGEDFBran9U7aT8=; b=F6pG6P48VdjWq+uVf7soFSzAaELSjnXy8nyJ6/Mx28vqEgMLzMj2vd7oqKJdAE01tI uXzzRDpzto2yKo3tWbnaVulwAEI1hj4jw64BauG5TJrdvQ+pr+Noz6OdcbzHYDfuORH/ +0tB5KzOOpAAFTeNk+C7MYv60hyxsFVr08oRPWTkHp+mL2+xL8hoOofewbKhjEvvv2m1 sW1pQm/eullvsSKCkrjtN//zaLs80fycyxRmeyLd1rdyrMqBXYkqARuyfzdh5n+qjWOg 4L/qYTrHr4NhviQToiClRbuuQFmqg8ETySY5cIMtN5SCcWHdwILrjwQrTQIrq/ERA+BO TQfg== X-Gm-Message-State: AC+VfDyzW6SqcfRaStYFv/Ynxlh/Ev+gN0bK7Q7hX6qoIIm37sVczKpv fTrQO0vDQ5yjo1Otde9CC5bgPRgKjvG54qq07Wg= X-Google-Smtp-Source: ACHHUZ7FpBIDMT28vWNt2HGra7ITQbV+oZRPA2Oy8MqgHpz7OmwfYPkhdMIRQSmNnaYmgI8WjwfrTacnRkaxs1HIrb0= X-Received: by 2002:a54:478b:0:b0:394:1b1e:9915 with SMTP id o11-20020a54478b000000b003941b1e9915mr10433421oic.22.1684175181338; Mon, 15 May 2023 11:26:21 -0700 (PDT) MIME-Version: 1.0 References: <436378BB-FDFA-43BD-A633-C030C347E683@gmail.com> <359D9C64-52A5-4BF5-91B5-72F7CE116F78@gmail.com> In-Reply-To: Date: Mon, 15 May 2023 20:26:09 +0200 Message-ID: To: Rowan Tommins Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] [Discussion] nameof From: landers.robert@gmail.com (Robert Landers) On Mon, May 15, 2023 at 8:18=E2=80=AFPM Rowan Tommins wrote: > > On 15 May 2023 18:44:47 BST, Robert Landers wr= ote: > >use const \NoExist\TEST; > >use \NoExist\Channel; > >echo TEST; > >echo Channel::class; > > > >the output is: > > > >Undefined constant "TEST" in ... > >Channel > > I'm not sure how you got that; according to https://3v4l.org/gltKN only P= HP 5.6 has a message with the unqualified name: > > > Notice: Use of undefined constant TEST - assumed 'TEST' in /in/gltKN on= line 5 > > Before that, there was no "use const", and in every version after that, i= t's a fatal error with the fully qualified name: > > > Fatal error: Uncaught Error: Undefined constant "NoExist\TEST" in /in/g= ltKN:5 > > Take the constant part away so that the next line runs, and https://3v4l.= org/q0XQO shows the fully qualified name right back up PHP 5.5, because exp= anding the name is actually the *only* thing that ::class does in that cont= ext. > > Regards, > > -- > Rowan Tommins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > php --version PHP 8.2.6 (cli) (built: May 12 2023 06:24:00) (NTS) Copyright (c) The PHP Group Zend Engine v4.2.6, Copyright (c) Zend Technologies with Zend OPcache v8.2.6, Copyright (c), by Zend Technologies with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans php -a Interactive shell php > use \NoExists\Channel; php > echo Channel::class; Channel Turns out, it's a CLI specific thing, when running in a file, it does indeed output the full name. I stand corrected; I tend to use the CLI for testing out stuff.