1
0
Fork 0

chore: fixes for unused variables and phpdoc (#496)

The identifier doesn't need to be generated for a notification to the
client, since there's no response
Add undeclared properties to TreeAnalyzer
Fix other bugs in phpdoc
pull/506/head
Tyson Andre 2017-10-22 22:54:38 -07:00 committed by Felix Becker
parent 16cf8f53e9
commit 1db6b7bbb3
6 changed files with 14 additions and 7 deletions

View File

@ -71,7 +71,6 @@ class ClientHandler
*/
public function notify(string $method, $params): Promise
{
$id = $this->idGenerator->generate();
return $this->protocolWriter->write(
new Protocol\Message(
new AdvancedJsonRpc\Notification($method, (object)$params)

View File

@ -56,7 +56,8 @@ class ComposerScripts
$parts['scheme'] = 'phpstubs';
$uri = Uri\build($parts);
$document = new PhpDocument($uri, $content, $index, $parser, $docBlockFactory, $definitionResolver);
// Create a new document and add it to $index
new PhpDocument($uri, $content, $index, $parser, $docBlockFactory, $definitionResolver);
}
$index->setComplete();

View File

@ -151,7 +151,7 @@ class TextDocument
* The document's truth now exists where the document's uri points to (e.g. if the document's uri is a file uri the
* truth now exists on disk).
*
* @param \LanguageServer\Protocol\TextDocumentItem $textDocument The document that was closed
* @param \LanguageServer\Protocol\TextDocumentIdentifier $textDocument The document that was closed
* @return void
*/
public function didClose(TextDocumentIdentifier $textDocument)

View File

@ -123,6 +123,7 @@ class Workspace
*/
public function xreferences($query, array $files = null): Promise
{
// TODO: $files is unused in the coroutine
return coroutine(function () use ($query, $files) {
if ($this->composerLock === null) {
return [];

View File

@ -9,12 +9,19 @@ use phpDocumentor\Reflection\DocBlockFactory;
use Sabre\Uri;
use Microsoft\PhpParser;
use Microsoft\PhpParser\Node;
use Microsoft\PhpParser\Token;
class TreeAnalyzer
{
/** @var PhpParser\Parser */
private $parser;
/** @var DocBlockFactory */
private $docBlockFactory;
/** @var DefinitionResolver */
private $definitionResolver;
/** @var Node\SourceFileNode */
private $sourceFileNode;
@ -57,7 +64,7 @@ class TreeAnalyzer
* and transforms them into LSP Format
*
* @param Node|Token $node
* @return Diagnostic
* @return void
*/
private function collectDiagnostics($node)
{
@ -203,7 +210,7 @@ class TreeAnalyzer
}
/**
* @return Definition
* @return Definition[]
*/
public function getDefinitions()
{

View File

@ -148,9 +148,8 @@ function isVendored(PhpDocument $document, \stdClass $composerJson = null): bool
* Check a given URI against the composer.json to see if it
* is a vendored URI
*
* @param \stdClass|null $composerJson
* @param string $uri
* @param array $matches
* @param \stdClass|null $composerJson
* @return string|null
*/
function getPackageName(string $uri, \stdClass $composerJson = null)