public function getParentClass()
{
if (!$this->node instanceof ClassNode || null === $this->node->extends) {
return null;
}
$objectType = (new FindTypeFromAst())->__invoke($this->node->extends, $this->locatedSource, $this->getNamespaceName());
if (null === $objectType || !$objectType instanceof Object_) {
return null;
}
// @TODO use actual `ClassReflector` or `FunctionReflector`?
/* @var $parent self */
$parent = $this->reflector->reflect((string) $objectType->getFqsen());
if ($parent->isInterface() || $parent->isTrait()) {
throw NotAClassReflection::fromReflectionClass($parent);
}
return $parent;
}