1
0
Fork 0

ci: Add ability to find documentation for static functions defined in parent contexts

pull/679/head
Martin Letáček 2018-10-28 21:00:00 +01:00
parent 18c6ccd137
commit df1444502c
1 changed files with 24 additions and 12 deletions

View File

@ -493,21 +493,33 @@ class DefinitionResolver
} elseif ($scoped->scopeResolutionQualifier instanceof Node\QualifiedName) { } elseif ($scoped->scopeResolutionQualifier instanceof Node\QualifiedName) {
$className = $scoped->scopeResolutionQualifier->getResolvedName(); $className = $scoped->scopeResolutionQualifier->getResolvedName();
} }
if ($scoped->memberName instanceof Node\Expression\Variable) { do {
if ($scoped->memberName instanceof Node\Expression\Variable) {
if ($scoped->parent instanceof Node\Expression\CallExpression) {
return null;
}
$memberName = $scoped->memberName->getName();
if (empty($memberName)) {
return null;
}
$name = (string)$className . '::$' . $memberName;
} else {
$name = (string)$className . '::' . $scoped->memberName->getText($scoped->getFileContents());
}
if ($scoped->parent instanceof Node\Expression\CallExpression) { if ($scoped->parent instanceof Node\Expression\CallExpression) {
return null; $name .= '()';
} }
$memberName = $scoped->memberName->getName(); $definition = $this->index->getDefinition($name);
if (empty($memberName)) { if(!!$definition) {
return null; break;
} else {
$class = $this->index->getDefinition((string)$className);
if(!$class) {
break;
}
$className = $class->extends[0];
} }
$name = (string)$className . '::$' . $memberName; } while (true);
} else {
$name = (string)$className . '::' . $scoped->memberName->getText($scoped->getFileContents());
}
if ($scoped->parent instanceof Node\Expression\CallExpression) {
$name .= '()';
}
return $name; return $name;
} }