From 450116e2f35e2b95ab389d441dfea37351d64b56 Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Sun, 11 Nov 2018 14:45:47 -0500 Subject: [PATCH 1/2] docs: remove unused use statements, nit on phpdoc (#625) * Remove unused use statements, nit on phpdoc Add a note on something that looks like an invalid array index * Remove phpdoc param with no real param --- src/Cache/ClientCache.php | 5 +++++ src/Client/TextDocument.php | 2 +- src/Definition.php | 4 ++-- src/Index/Index.php | 1 - src/PhpDocument.php | 2 +- src/SignatureHelpProvider.php | 3 +-- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Cache/ClientCache.php b/src/Cache/ClientCache.php index bc91b97..e92a3d5 100644 --- a/src/Cache/ClientCache.php +++ b/src/Cache/ClientCache.php @@ -11,6 +11,11 @@ use Sabre\Event\Promise; */ class ClientCache implements Cache { + /** + * @var LanguageClient + */ + public $client; + /** * @param LanguageClient $client */ diff --git a/src/Client/TextDocument.php b/src/Client/TextDocument.php index 7630438..03211fa 100644 --- a/src/Client/TextDocument.php +++ b/src/Client/TextDocument.php @@ -4,7 +4,7 @@ declare(strict_types = 1); namespace LanguageServer\Client; use LanguageServer\ClientHandler; -use LanguageServerProtocol\{TextDocumentItem, TextDocumentIdentifier}; +use LanguageServerProtocol\{Diagnostic, TextDocumentItem, TextDocumentIdentifier}; use Sabre\Event\Promise; use JsonMapper; diff --git a/src/Definition.php b/src/Definition.php index 9ea27f9..d81594d 100644 --- a/src/Definition.php +++ b/src/Definition.php @@ -4,7 +4,7 @@ declare(strict_types = 1); namespace LanguageServer; use LanguageServer\Index\ReadableIndex; -use phpDocumentor\Reflection\{Types, Type, Fqsen, TypeResolver}; +use phpDocumentor\Reflection\{Types, Type, TypeResolver}; use LanguageServerProtocol\SymbolInformation; use Generator; @@ -80,7 +80,7 @@ class Definition * Can also be a compound type. * If it is unknown, will be Types\Mixed_. * - * @var \phpDocumentor\Type|null + * @var Type|null */ public $type; diff --git a/src/Index/Index.php b/src/Index/Index.php index 0c8e3e9..0d61f9c 100644 --- a/src/Index/Index.php +++ b/src/Index/Index.php @@ -274,7 +274,6 @@ class Index implements ReadableIndex, \Serializable } /** - * @param string $serialized * @return string */ public function serialize() diff --git a/src/PhpDocument.php b/src/PhpDocument.php index 0547615..d148f9c 100644 --- a/src/PhpDocument.php +++ b/src/PhpDocument.php @@ -63,7 +63,7 @@ class PhpDocument /** * Map from fully qualified name (FQN) to Node * - * @var Node + * @var Node[] */ private $definitionNodes; diff --git a/src/SignatureHelpProvider.php b/src/SignatureHelpProvider.php index 43851b0..66afd5f 100644 --- a/src/SignatureHelpProvider.php +++ b/src/SignatureHelpProvider.php @@ -6,8 +6,7 @@ namespace LanguageServer; use LanguageServer\Index\ReadableIndex; use LanguageServerProtocol\{ Position, - SignatureHelp, - ParameterInformation + SignatureHelp }; use Microsoft\PhpParser\Node; use Sabre\Event\Promise; From 1da3328bc23ebd6418529035d357481c8c028640 Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Tue, 13 Nov 2018 18:33:11 +0100 Subject: [PATCH 2/2] fix: allow rootUri to be null Fixes #684 --- src/LanguageServer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LanguageServer.php b/src/LanguageServer.php index a30992b..38dfeb1 100644 --- a/src/LanguageServer.php +++ b/src/LanguageServer.php @@ -167,7 +167,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher */ public function initialize(ClientCapabilities $capabilities, string $rootPath = null, int $processId = null, string $rootUri = null): Promise { - if ($rootPath === null) { + if ($rootPath === null && $rootUri !== null) { $rootPath = uriToPath($rootUri); } return coroutine(function () use ($capabilities, $rootPath, $processId) {