On 15 May 2023 19:26:09 BST, Robert Landers <landers.rob...@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]

Reply via email to