Cleanup, fix incorrect count() usage
parent
344a2cef31
commit
0a15afc130
|
@ -880,7 +880,7 @@ class DefinitionResolver
|
||||||
* Takes any class name node (from a static method call, or new node) and returns a Type object
|
* Takes any class name node (from a static method call, or new node) and returns a Type object
|
||||||
* Resolves keywords like self, static and parent
|
* Resolves keywords like self, static and parent
|
||||||
*
|
*
|
||||||
* @param Node || PhpParser\Token $class
|
* @param Node | PhpParser\Token $class
|
||||||
* @return Type
|
* @return Type
|
||||||
*/
|
*/
|
||||||
public function resolveClassNameToType($class): Type
|
public function resolveClassNameToType($class): Type
|
||||||
|
@ -1079,7 +1079,7 @@ class DefinitionResolver
|
||||||
// namespace A\B; A\B
|
// namespace A\B; A\B
|
||||||
if ($node instanceof Node\Statement\NamespaceDefinition && $node->name instanceof Node\QualifiedName) {
|
if ($node instanceof Node\Statement\NamespaceDefinition && $node->name instanceof Node\QualifiedName) {
|
||||||
$name = (string) PhpParser\ResolvedName::buildName($node->name->nameParts, $node->getFileContents());
|
$name = (string) PhpParser\ResolvedName::buildName($node->name->nameParts, $node->getFileContents());
|
||||||
return \count($name) > 0 ? $name : null;
|
return \strlen($name) > 0 ? $name : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// INPUT OUTPUT:
|
// INPUT OUTPUT:
|
||||||
|
@ -1088,7 +1088,7 @@ class DefinitionResolver
|
||||||
if ($node instanceof Node\Statement\FunctionDeclaration) {
|
if ($node instanceof Node\Statement\FunctionDeclaration) {
|
||||||
// Function: use functionName() as the name
|
// Function: use functionName() as the name
|
||||||
$name = (string)$node->getNamespacedName();
|
$name = (string)$node->getNamespacedName();
|
||||||
return \count($name) > 0 ? $name . '()' : null;
|
return \strlen($name) > 0 ? $name . '()' : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// INPUT OUTPUT
|
// INPUT OUTPUT
|
||||||
|
|
|
@ -67,7 +67,7 @@ class SymbolInformation
|
||||||
$symbol->kind = SymbolKind::FUNCTION;
|
$symbol->kind = SymbolKind::FUNCTION;
|
||||||
} else if ($node instanceof Node\MethodDeclaration) {
|
} else if ($node instanceof Node\MethodDeclaration) {
|
||||||
$nameText = $node->getName();
|
$nameText = $node->getName();
|
||||||
if ($nameText === '__construct' || $nameText === '__destruct') {
|
if ($nameText === '__construct' || $nameText === '__destruct') {
|
||||||
$symbol->kind = SymbolKind::CONSTRUCTOR;
|
$symbol->kind = SymbolKind::CONSTRUCTOR;
|
||||||
} else {
|
} else {
|
||||||
$symbol->kind = SymbolKind::METHOD;
|
$symbol->kind = SymbolKind::METHOD;
|
||||||
|
|
Loading…
Reference in New Issue