public function getHierarchyDepth(CodeBase $code_base) : int
{
if (!$this->hasParentType()) {
return 0;
}
if (!$code_base->hasClassWithFQSEN($this->getParentClassFQSEN())) {
// Let this emit an issue elsewhere for the
// parent not existing
return 0;
}
// Get the parent class
$parent = $this->getParentClass($code_base);
// Prevent infinite loops
if ($parent == $this) {
return 0;
}
return 1 + $parent->getHierarchyDepth($code_base);
}