fix definitions namespaced function calls
parent
d02253c9f6
commit
afca7ea7e0
|
@ -112,6 +112,7 @@ class LoggedTolerantDefinitionResolver extends TolerantDefinitionResolver
|
||||||
*/
|
*/
|
||||||
public function resolveReferenceNodeToDefinition($node)
|
public function resolveReferenceNodeToDefinition($node)
|
||||||
{
|
{
|
||||||
|
var_dump(array_keys($this->index->getDefinitions()));
|
||||||
self::$logger = true;
|
self::$logger = true;
|
||||||
return $this->logMethod('resolveReferenceNodeToDefinition', $node);
|
return $this->logMethod('resolveReferenceNodeToDefinition', $node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
|
||||||
/**
|
/**
|
||||||
* @var \LanguageServer\Index\ReadableIndex
|
* @var \LanguageServer\Index\ReadableIndex
|
||||||
*/
|
*/
|
||||||
private $index;
|
protected $index;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \phpDocumentor\Reflection\TypeResolver
|
* @var \phpDocumentor\Reflection\TypeResolver
|
||||||
|
@ -244,14 +244,14 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function resolveReferenceNodeToFqn($node) {
|
public function resolveReferenceNodeToFqn($node) {
|
||||||
|
|
||||||
|
|
||||||
$parent = $node->getParent();
|
$parent = $node->getParent();
|
||||||
// TODO all name tokens should be a part of a node
|
// TODO all name tokens should be a part of a node
|
||||||
if ($node instanceof Tolerant\Node\QualifiedName) {
|
if ($node instanceof Tolerant\Node\QualifiedName) {
|
||||||
// For extends, implements, type hints and classes of classes of static calls use the name directly
|
// For extends, implements, type hints and classes of classes of static calls use the name directly
|
||||||
$name = (string)($node->getResolvedName() ?? $node->getText());
|
$name = $node->getResolvedName();
|
||||||
|
|
||||||
if (($useClause = $node->getFirstAncestor(Tolerant\Node\NamespaceUseGroupClause::class, Tolerant\Node\Statement\NamespaceUseDeclaration::class)) !== null) {
|
if (($useClause = $node->getFirstAncestor(Tolerant\Node\NamespaceUseGroupClause::class, Tolerant\Node\Statement\NamespaceUseDeclaration::class)) !== null) {
|
||||||
|
$name = (string)($name ?? $node->getText());
|
||||||
if ($useClause instanceof Tolerant\Node\NamespaceUseGroupClause) {
|
if ($useClause instanceof Tolerant\Node\NamespaceUseGroupClause) {
|
||||||
$prefix = $useClause->parent->parent->namespaceName;
|
$prefix = $useClause->parent->parent->namespaceName;
|
||||||
$prefix = $prefix === null ? "" : $prefix->getText();
|
$prefix = $prefix === null ? "" : $prefix->getText();
|
||||||
|
@ -267,6 +267,9 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
|
||||||
$name .= '()';
|
$name .= '()';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$name = (string)($name ?? (string)$node->getNamespacedName());
|
||||||
|
}
|
||||||
|
|
||||||
if ($node->parent instanceof Tolerant\Node\Expression\CallExpression) {
|
if ($node->parent instanceof Tolerant\Node\Expression\CallExpression) {
|
||||||
$name .= '()';
|
$name .= '()';
|
||||||
|
@ -333,6 +336,7 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
|
||||||
// Left-hand expression could not be resolved to a class
|
// Left-hand expression could not be resolved to a class
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
var_dump("AAAHHHHH");
|
||||||
$classFqn = substr((string)$varType->getFqsen(), 1);
|
$classFqn = substr((string)$varType->getFqsen(), 1);
|
||||||
var_dump($classFqn);
|
var_dump($classFqn);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue