Re: [RFC] [Discussion] nameof
| From: | Rowan Tommins | Date: | Mon, 15 May 2023 18:48:55 +0000 |
| Subject: | Re: [RFC] [Discussion] nameof | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120298@lists.php.net to get a copy of this message | ||
On 15 May 2023 19:26:09 BST, Robert Landers <landers.robert@gmail.com> wrote:
>php -a
>Interactive shell
>
>php > use \NoExists\Channel;
>php > echo Channel::class;
>Channel
>
>Turns out, it's a CLI specific thing
Ah, probably each line in the interactive shell is considered a separate compilation context, like a
separate file, so the use statement is no longer in effect on the next line.
3v4l.org is great for verifying things like this, because you can see at a glance if there's
been a change in behaviour in previous versions, or indeed versions newer than you have installed.
If you've got an up to date PhpStorm, you can actually use it directly from a scratch file.
(Huge shout-out to Sjön Hortensius for making and maintaining such a useful tool!)
Regards,
--
Rowan Tommins
[IMSoP]