/** * Gets a ReflectionClass for the type hint (returns null if not a class) * * @return ReflectionClass|null */ public function getClass() { $hint = $this->getTypeHint(); if (!$hint instanceof Types\Object_) { return null; } if (!$this->reflector instanceof ClassReflector) { throw new \RuntimeException('Unable to reflect class type because we were not given a ClassReflector'); } return $this->reflector->reflect($hint->getFqsen()->__toString()); }
/** * Given an AST Node\Name, create a new ReflectionClass for the element. * This should work with traits, interfaces and classes alike, as long as * the FQSEN resolves to something that exists. * * You may optionally specify a source locator that will be used to locate * the traits. If no source locator is given, a default will be used. * * @param Node\Name $node * @return ReflectionClass */ private function reflectClassForNamedNode(Node\Name $node) { // @TODO use actual `ClassReflector` or `FunctionReflector`? return $this->reflector->reflect($this->getFqsenFromNamedNode($node)); }