Reputation: 135
When a class has been specified in a use statement, it can be referred to by the final element of the fully namespaced class name. Evidently PHP knows from the short name the identity of the class. Is there a way to obtain this information?
Or is there any other way to deal with the issue - I want to know if the class exists. Obviously it is possible to write the fully namespaced name of the class and call class_exists() but this means that information is duplicated between the use statement and the call to class_exists(), which is a bad principle.
A somewhat similar question is at get full class name from short class name but differs significantly because there is no use statement to give the required information in that case.
Searched, found nothing relevant.
EDIT: I'm grateful for the link to the earlier answer, although I'm not deleting my question because I think the way the question is phrased is more likely to be found by someone looking for what I was looking for.
Upvotes: 0
Views: 33