Finally, the official answer is ... relatively speaking. It was introduced to me by someone identified by requinix@php.net in the bu report that I created today. The only exception is how this relates to the development of PHP.
TL; DR
PHP does not need to define a class to get its fully qualified name. All the necessary information is available at compile time, so it does not need to be downloaded.
Director Cut
Namespaces such as use are allowed at compile time, i.e. when the file is compiled before its execution. That is why there are strict requirements for their use.
Because of all these requirements, when PHP encounters a class name, it can immediately find out its full name. Seeing this as a file system, the namespace will be a directory for relative locations, and usage will be symbolic links.
The class name is either absolute ("\ Testing \ Test") or relative ("Test"), and if relative it can be a normal name. [more context required]
namespace Testing { echo Test::class;
Or an alias:
use Testing\Test as AliasedTest; echo AliasedTest::class; // AliasedTest + use = \Testing\Test
Without this startup, it wonβt work!
::class is just a new disclosure tool that PHP has always known.
This "extended answer" pretty much matches what I got as an error report. The reason for such an obvious copy and paste is that, initially, I created this answer for another community
Bruno augusto
source share