1
0
Fork 0

Improve handling of abstract classes (#391)

pull/395/head
Jens Hausdorf 2017-06-09 22:12:32 +02:00 committed by Felix Becker
parent 7f427a1215
commit 42d0c7b714
2 changed files with 8 additions and 4 deletions

View File

@ -114,7 +114,7 @@ class DefinitionResolver
// For everything else, get the doc block summary corresponding to the current node.
$docBlock = $this->getDocBlock($node);
if ($docBlock !== null) {
// check wether we have a description, when true, add a new paragraph
// check whether we have a description, when true, add a new paragraph
// with the description
$description = $docBlock->getDescription()->render();
@ -174,7 +174,11 @@ class DefinitionResolver
$def->fqn = $fqn;
// Determines whether the suggestion will show after "new"
$def->canBeInstantiated = $node instanceof Node\Statement\ClassDeclaration;
$def->canBeInstantiated = (
$node instanceof Node\Statement\ClassDeclaration &&
// check whether it is not an abstract class
($node->abstractOrFinalModifier === null || $node->abstractOrFinalModifier->kind !== PhpParser\TokenKind::AbstractKeyword)
);
// Interfaces, classes, traits, namespaces, functions, and global const elements
$def->isGlobal = (

View File

@ -106,7 +106,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
protected $definitionResolver;
/**
* @param PotocolReader $reader
* @param ProtocolReader $reader
* @param ProtocolWriter $writer
*/
public function __construct(ProtocolReader $reader, ProtocolWriter $writer)
@ -132,7 +132,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
// If a ResponseError is thrown, send it back in the Response
$error = $e;
} catch (Throwable $e) {
// If an unexpected error occured, send back an INTERNAL_ERROR error response
// If an unexpected error occurred, send back an INTERNAL_ERROR error response
$error = new AdvancedJsonRpc\Error(
(string)$e,
AdvancedJsonRpc\ErrorCode::INTERNAL_ERROR,