Finally an official response... in terms. It was given to me by someone identified by [email protected] from of this bug that I myself reported. It’s just the caveat that I don’t know exactly how involved with language development that person is.
TL;DR
PHP does not need the definition of a class to know its full name. Everything he needs he gets at compile time and therefore does not need to load it.
Director’s version
Namespaces as well as the you use are solved at compile time, that is, when PHP compiles the file before of its execution. For this reason there are specific requirements on how they can be used.
Because of all these requirements, when PHP finds the name of a class it already knows, in readiness, its full name. Imagining this as a file system, the namespace would be like a directory for the relative locations and the use would be symbolic links (symlinks).
The class name can be either absolute ("Testing Test") or relative ("Test") and if relative can be a normal name[lacks context].
namespace Testing {
echo Test::class; // \Testing + Test = \Testing\Test
}
Or a alias:
use Testing\Test as AliasedTest;
echo AliasedTest::class; // AliasedTest + use = \Testing\Test
Without all this the self-loading class would not function!
::class
is just a new way to expose this information that PHP already knows about.
Why exactly I believe that only those involved in the development of PHP 5.5 (or that understand C) would be able to answer but, if I had to guess, I would say that it is because of/Late Static Binding that would delay the resolution until the operator :: (T_PAAMAYIM_NEKUDOTAYIM) assuming the class associated with it.
– Bruno Augusto
I couldn’t figure out why, but anyone who wants to research can look at proposal for such an appeal and the pull request in the repository.
– bfavaretto
So, from what I understand, the idea would be to just get 'Fully Qualified' class names effortlessly and more elegantly using aliases rather than gigantic strings with possible errors. @bfavaretto good tip, by the way
– Virgílio Santos
I’ve been looking for this and I don’t think kkkkkkkkkk one time we find !!!! kkkkkk
– user6026
Let’s see if now stimulates the topic ^_^
– Bruno Augusto
In no way can an undeclared class be evaluated even if it is an external attribute. I hope I have helped
– FRNathan13
@Nathan130200: Helping, helping, not helping (hehe). The whole discussion is exactly why this alien works when it should throw an error precisely because the class has not been declared.
– Bruno Augusto
This statement also does not generate an error when the class does not exist. Could there be something correlated with it?
function foo(TTT $a){

}
– Wallace Maxters
@Wallacemaxters probably yes. See the answer extended below
– Bruno Augusto
What was the reason for -1? Could you show how I can improve the question?
– Wallace Maxters