1
0
Fork 0

Cleanup, fix incorrect count() usage

pull/357/head
Rob Lourens 2017-06-07 14:34:18 -07:00
parent 344a2cef31
commit 0a15afc130
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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;