HAVE:
- An instance of
ReflectionNamedType.
NEED a technique that will enable me to:
-
Reliably create an instance of
ReflectionClassobject for the type represented by theReflectionNamedTypeobject IF AND ONLY IF the type is actually a class type, i.e. theReflectionClassconstructor 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
ReflectionExceptionfrom theReflectionClassconstructor 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