HAVE:
- An instance of
ReflectionNamedType
.
NEED a technique that will enable me to:
-
Reliably create an instance of
ReflectionClass
object for the type represented by theReflectionNamedType
object IF AND ONLY IF the type is actually a class type, i.e. theReflectionClass
constructor with that type name would succeed (barring autoload failure). -
Reliably not crash or throw otherwise.
CONSTRAINED BY the following additional requirement:
- The implementation MUST NOT use a hardcoded list of edge case type names. Everything must be pure reflection.
- The implementation MUST NOT use the deprecated
->getClass()
method. - The implementation MUST NOT rely on catching
ReflectionException
from theReflectionClass
constructor in order to determine that the type is not a class type.
Is this currently doable, or must some constraints be relaxed?
Aucun commentaire:
Enregistrer un commentaire