1
0
Fork 0

switched from property_exists to instanceof

pull/438/head
Ivan Bozhanov 2017-07-15 22:03:09 +03:00
parent 7d64f060e8
commit b5bfaa9877
1 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,9 @@ use LanguageServer\Protocol\SymbolInformation;
use LanguageServer\Protocol\ParameterInformation; use LanguageServer\Protocol\ParameterInformation;
use Microsoft\PhpParser; use Microsoft\PhpParser;
use Microsoft\PhpParser\Node; use Microsoft\PhpParser\Node;
use Microsoft\PhpParser\Node\Expression\AnonymousFunctionCreationExpression;
use Microsoft\PhpParser\Node\MethodDeclaration;
use Microsoft\PhpParser\Node\Statement\FunctionDeclaration;
use phpDocumentor\Reflection\{ use phpDocumentor\Reflection\{
DocBlock, DocBlockFactory, Fqsen, Type, TypeResolver, Types DocBlock, DocBlockFactory, Fqsen, Type, TypeResolver, Types
}; };
@ -236,7 +239,11 @@ class DefinitionResolver
} }
$def->parameters = []; $def->parameters = [];
if (property_exists($node, 'parameters') && $node->parameters) { if (($node instanceof MethodDeclaration ||
$node instanceof FunctionDeclaration ||
$node instanceof AnonymousFunctionCreationExpression) &&
$node->parameters !== null
) {
foreach ($node->parameters->getElements() as $param) { foreach ($node->parameters->getElements() as $param) {
$def->parameters[] = new ParameterInformation( $def->parameters[] = new ParameterInformation(
$this->getDeclarationLineFromNode($param), $this->getDeclarationLineFromNode($param),