From 95a82dcdfeacb4966c9af67c73ae30b41e0a17ae Mon Sep 17 00:00:00 2001 From: Ivan Bozhanov Date: Sat, 15 Jul 2017 02:12:48 +0300 Subject: [PATCH 1/8] initial signature help commit --- fixtures/signature/funcClosed.php | 7 + fixtures/signature/funcNotClosed.php | 7 + fixtures/signature/methodClosed.php | 15 ++ fixtures/signature/methodNotClosed.php | 17 ++ fixtures/signature/staticClosed.php | 10 + fixtures/signature/staticNotClosed.php | 10 + src/Definition.php | 7 + src/DefinitionResolver.php | 13 + src/LanguageServer.php | 6 +- src/Protocol/ParameterInformation.php | 9 + src/Protocol/SignatureHelp.php | 11 + src/Protocol/SignatureInformation.php | 12 + src/Server/TextDocument.php | 15 +- src/SignatureHelpProvider.php | 92 ++++++++ tests/LanguageServerTest.php | 5 +- .../Server/TextDocument/SignatureHelpTest.php | 222 ++++++++++++++++++ 16 files changed, 455 insertions(+), 3 deletions(-) create mode 100644 fixtures/signature/funcClosed.php create mode 100644 fixtures/signature/funcNotClosed.php create mode 100644 fixtures/signature/methodClosed.php create mode 100644 fixtures/signature/methodNotClosed.php create mode 100644 fixtures/signature/staticClosed.php create mode 100644 fixtures/signature/staticNotClosed.php create mode 100644 src/SignatureHelpProvider.php create mode 100644 tests/Server/TextDocument/SignatureHelpTest.php diff --git a/fixtures/signature/funcClosed.php b/fixtures/signature/funcClosed.php new file mode 100644 index 0000000..6012844 --- /dev/null +++ b/fixtures/signature/funcClosed.php @@ -0,0 +1,7 @@ +method(); + } +} + +$a = new HelpClass1; +$a->method(); \ No newline at end of file diff --git a/fixtures/signature/methodNotClosed.php b/fixtures/signature/methodNotClosed.php new file mode 100644 index 0000000..d5ce4cc --- /dev/null +++ b/fixtures/signature/methodNotClosed.php @@ -0,0 +1,17 @@ +method(1,1); + } +} +$a = new HelpClass2; +$a + ->method( + 1, + array(), diff --git a/fixtures/signature/staticClosed.php b/fixtures/signature/staticClosed.php new file mode 100644 index 0000000..301009f --- /dev/null +++ b/fixtures/signature/staticClosed.php @@ -0,0 +1,10 @@ +documentation = $this->getDocumentationFromNode($node); } + $def->parameters = []; + if (property_exists($node, 'parameters') && $node->parameters) { + foreach ($node->parameters->getElements() as $param) { + //var_dump($param); die(); + $def->parameters[] = new ParameterInformation( + $this->getDeclarationLineFromNode($param), + //$param->getName(), // TODO: rebuild this + $this->getDocumentationFromNode($param) + ); + } + } + return $def; } diff --git a/src/LanguageServer.php b/src/LanguageServer.php index 118dd93..0a3f9ff 100644 --- a/src/LanguageServer.php +++ b/src/LanguageServer.php @@ -9,7 +9,8 @@ use LanguageServer\Protocol\{ TextDocumentSyncKind, Message, InitializeResult, - CompletionOptions + CompletionOptions, + SignatureHelpOptions }; use LanguageServer\FilesFinder\{FilesFinder, ClientFilesFinder, FileSystemFilesFinder}; use LanguageServer\ContentRetriever\{ContentRetriever, ClientContentRetriever, FileSystemContentRetriever}; @@ -277,6 +278,9 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher $serverCapabilities->completionProvider = new CompletionOptions; $serverCapabilities->completionProvider->resolveProvider = false; $serverCapabilities->completionProvider->triggerCharacters = ['$', '>']; + // support signature help + $serverCapabilities->signatureHelpProvider = new SignatureHelpOptions; + $serverCapabilities->signatureHelpProvider->triggerCharacters = ['(',',']; // Support global references $serverCapabilities->xworkspaceReferencesProvider = true; $serverCapabilities->xdefinitionProvider = true; diff --git a/src/Protocol/ParameterInformation.php b/src/Protocol/ParameterInformation.php index 89b5e53..98c6c87 100644 --- a/src/Protocol/ParameterInformation.php +++ b/src/Protocol/ParameterInformation.php @@ -23,4 +23,13 @@ class ParameterInformation * @var string|null */ public $documentation; + /** + * @param string $label The label of this signature. Will be shown in the UI. + * @param string|null $documentation The human-readable doc-comment of this signature. + */ + public function __construct(string $label = null, string $documentation = null) + { + $this->label = $label; + $this->documentation = $documentation; + } } diff --git a/src/Protocol/SignatureHelp.php b/src/Protocol/SignatureHelp.php index 407b25a..a99ef58 100644 --- a/src/Protocol/SignatureHelp.php +++ b/src/Protocol/SignatureHelp.php @@ -29,4 +29,15 @@ class SignatureHelp * @var int|null */ public $activeParameter; + /** + * @param SignatureInformation[] $signatures The signatures. + * @param int|null $activeSignature The active signature. + * @param int|null $activeParameter The active parameter of the active signature. + */ + public function __construct(array $signatures = [], int $activeSignature = null, int $activeParameter = null) + { + $this->signatures = $signatures; + $this->activeSignature = $activeSignature; + $this->activeParameter = $activeParameter; + } } diff --git a/src/Protocol/SignatureInformation.php b/src/Protocol/SignatureInformation.php index 77e152c..e1d4273 100644 --- a/src/Protocol/SignatureInformation.php +++ b/src/Protocol/SignatureInformation.php @@ -31,4 +31,16 @@ class SignatureInformation * @var ParameterInformation[]|null */ public $parameters; + + /** + * @param string $label The label of this signature. Will be shown in the UI. + * @param string|null $documentation The human-readable doc-comment of this signature. + * @param ParameterInformation[]|null $parameters The parameters of this signature. + */ + public function __construct(string $label = null, string $documentation = null, array $parameters = null) + { + $this->label = $label; + $this->documentation = $documentation; + $this->parameters = $parameters; + } } diff --git a/src/Server/TextDocument.php b/src/Server/TextDocument.php index 5a2819e..e936cf8 100644 --- a/src/Server/TextDocument.php +++ b/src/Server/TextDocument.php @@ -4,7 +4,7 @@ declare(strict_types = 1); namespace LanguageServer\Server; use LanguageServer\{ - CompletionProvider, LanguageClient, PhpDocument, PhpDocumentLoader, DefinitionResolver + CompletionProvider, LanguageClient, PhpDocument, PhpDocumentLoader, DefinitionResolver, SignatureHelpProvider }; use LanguageServer\Index\ReadableIndex; use LanguageServer\Protocol\{ @@ -72,6 +72,10 @@ class TextDocument * @var \stdClass|null */ protected $composerLock; + /** + * @var SignatureHelpProvider + */ + protected $signatureHelpProvider; /** * @param PhpDocumentLoader $documentLoader @@ -93,6 +97,7 @@ class TextDocument $this->client = $client; $this->definitionResolver = $definitionResolver; $this->completionProvider = new CompletionProvider($this->definitionResolver, $index); + $this->signatureHelpProvider = new SignatureHelpProvider($this->definitionResolver, $index); $this->index = $index; $this->composerJson = $composerJson; $this->composerLock = $composerLock; @@ -411,4 +416,12 @@ class TextDocument return [new SymbolLocationInformation($descriptor, $def->symbolInformation->location)]; }); } + + public function signatureHelp(TextDocumentIdentifier $textDocument, Position $position): Promise + { + return coroutine(function () use ($textDocument, $position) { + $document = yield $this->documentLoader->getOrLoad($textDocument->uri); + return $this->signatureHelpProvider->provideSignature($document, $position); + }); + } } diff --git a/src/SignatureHelpProvider.php b/src/SignatureHelpProvider.php new file mode 100644 index 0000000..5af3e97 --- /dev/null +++ b/src/SignatureHelpProvider.php @@ -0,0 +1,92 @@ +definitionResolver = $definitionResolver; + $this->index = $index; + } + + /** + * Returns signature help for a specific cursor position in a document + * + * @param PhpDocument $doc The opened document + * @param Position $pos The cursor position + * @return SignatureHelp + */ + public function provideSignature(PhpDocument $doc, Position $pos) : SignatureHelp + { + $node = $doc->getNodeAtPosition($pos); + while ($node && + !($node instanceof ArgumentExpressionList) && + !($node instanceof CallExpression) && + $node->parent + ) { + $node = $node->parent; + } + if (!($node instanceof ArgumentExpressionList) && + !($node instanceof CallExpression) + ) { + return new SignatureHelp; + } + $count = 0; + if ($node instanceof ArgumentExpressionList) { + foreach ($node->getElements() as $param) { + $count ++; + } + while ($node && !($node instanceof CallExpression) && $node->parent) { + $node = $node->parent; + } + if (!($node instanceof CallExpression)) { + return new SignatureHelp; + } + } + $def = $this->definitionResolver->resolveReferenceNodeToDefinition($node->callableExpression); + if (!$def) { + return new SignatureHelp; + } + $params = array_map(function ($v) { + return $v->label; + }, $def->parameters); + return new SignatureHelp( + [ + new SignatureInformation( + trim(str_replace(['public', 'protected', 'private', 'function', 'static'], '', $def->declarationLine)), + $def->documentation, + $def->parameters + ) + ], + 0, + $count < count($def->parameters) ? $count : null + ); + } +} diff --git a/tests/LanguageServerTest.php b/tests/LanguageServerTest.php index 5d03451..95967ac 100644 --- a/tests/LanguageServerTest.php +++ b/tests/LanguageServerTest.php @@ -14,7 +14,8 @@ use LanguageServer\Protocol\{ TextDocumentIdentifier, InitializeResult, ServerCapabilities, - CompletionOptions + CompletionOptions, + SignatureHelpOptions }; use AdvancedJsonRpc; use Webmozart\Glob\Glob; @@ -41,6 +42,8 @@ class LanguageServerTest extends TestCase $serverCapabilities->completionProvider = new CompletionOptions; $serverCapabilities->completionProvider->resolveProvider = false; $serverCapabilities->completionProvider->triggerCharacters = ['$', '>']; + $serverCapabilities->signatureHelpProvider = new SignatureHelpOptions; + $serverCapabilities->signatureHelpProvider->triggerCharacters = ['(',',']; $serverCapabilities->xworkspaceReferencesProvider = true; $serverCapabilities->xdefinitionProvider = true; $serverCapabilities->xdependenciesProvider = true; diff --git a/tests/Server/TextDocument/SignatureHelpTest.php b/tests/Server/TextDocument/SignatureHelpTest.php new file mode 100644 index 0000000..76613e1 --- /dev/null +++ b/tests/Server/TextDocument/SignatureHelpTest.php @@ -0,0 +1,222 @@ +loader = new PhpDocumentLoader($contentRetriever, $projectIndex, $definitionResolver); + $this->loader->load(pathToUri(__DIR__ . '/../../../fixtures/global_symbols.php'))->wait(); + $this->loader->load(pathToUri(__DIR__ . '/../../../fixtures/symbols.php'))->wait(); + $this->textDocument = new Server\TextDocument($this->loader, $definitionResolver, $client, $projectIndex); + } + + public function testMethodClosed() + { + $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/methodClosed.php'); + $this->loader->open($completionUri, file_get_contents($completionUri)); + $result = $this->textDocument->signatureHelp( + new TextDocumentIdentifier($completionUri), + new Position(9, 22) + )->wait(); + + $this->assertEquals(new SignatureHelp( + [ + new SignatureInformation( + 'method(string $param = "")', + null, + [ + new ParameterInformation('string $param = ""') + ] + ) + ] + ), $result); + } + + public function testMethodClosedReference() + { + $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/methodClosed.php'); + $this->loader->open($completionUri, file_get_contents($completionUri)); + $result = $this->textDocument->signatureHelp( + new TextDocumentIdentifier($completionUri), + new Position(14, 11) + )->wait(); + + $this->assertEquals(new SignatureHelp( + [ + new SignatureInformation( + 'method(string $param = "")', + null, + [ + new ParameterInformation('string $param = ""') + ] + ) + ] + ), $result); + } + + public function testMethodNotClosed() + { + $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/methodNotClosed.php'); + $this->loader->open($completionUri, file_get_contents($completionUri)); + $result = $this->textDocument->signatureHelp( + new TextDocumentIdentifier($completionUri), + new Position(9, 22) + )->wait(); + + $this->assertEquals(new SignatureHelp( + [ + new SignatureInformation( + 'method(string $param = "")', + null, + [ + new ParameterInformation('string $param = ""') + ] + ) + ] + ), $result); + } + + public function testMethodNotClosedReference() + { + $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/methodNotClosed.php'); + $this->loader->open($completionUri, file_get_contents($completionUri)); + $result = $this->textDocument->signatureHelp( + new TextDocumentIdentifier($completionUri), + new Position(14, 14) + )->wait(); + + $this->assertEquals(new SignatureHelp( + [ + new SignatureInformation( + 'method(string $param = "")', + null, + [ + new ParameterInformation('string $param = ""') + ] + ) + ] + ), $result); + } + + public function testFuncClosed() + { + $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/funcClosed.php'); + $this->loader->open($completionUri, file_get_contents($completionUri)); + $result = $this->textDocument->signatureHelp( + new TextDocumentIdentifier($completionUri), + new Position(6, 10) + )->wait(); + + $this->assertEquals(new SignatureHelp( + [ + new SignatureInformation( + 'helpFunc1(int $count = 0)', + null, + [ + new ParameterInformation('int $count = 0') + ] + ) + ] + ), $result); + } + + public function testFuncNotClosed() + { + $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/funcNotClosed.php'); + $this->loader->open($completionUri, file_get_contents($completionUri)); + $result = $this->textDocument->signatureHelp( + new TextDocumentIdentifier($completionUri), + new Position(6, 10) + )->wait(); + + $this->assertEquals(new SignatureHelp( + [ + new SignatureInformation( + 'helpFunc2(int $count = 0)', + null, + [ + new ParameterInformation('int $count = 0') + ] + ) + ] + ), $result); + } + + public function testStaticClosed() + { + $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/staticClosed.php'); + $this->loader->open($completionUri, file_get_contents($completionUri)); + $result = $this->textDocument->signatureHelp( + new TextDocumentIdentifier($completionUri), + new Position(9, 19) + )->wait(); + + $this->assertEquals(new SignatureHelp( + [ + new SignatureInformation( + 'method(string $param = "")', + null, + [ + new ParameterInformation('string $param = ""') + ] + ) + ] + ), $result); + } + + public function testStaticNotClosed() + { + $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/staticNotClosed.php'); + $this->loader->open($completionUri, file_get_contents($completionUri)); + $result = $this->textDocument->signatureHelp( + new TextDocumentIdentifier($completionUri), + new Position(9, 19) + )->wait(); + + $this->assertEquals(new SignatureHelp( + [ + new SignatureInformation( + 'method(string $param = "")', + null, + [ + new ParameterInformation('string $param = ""') + ] + ) + ] + ), $result); + } +} From 5c827d2edacdee5ace5385affbcfef765d0e6b3c Mon Sep 17 00:00:00 2001 From: Ivan Bozhanov Date: Sat, 15 Jul 2017 02:21:58 +0300 Subject: [PATCH 2/8] fixed crashes --- src/SignatureHelpProvider.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/SignatureHelpProvider.php b/src/SignatureHelpProvider.php index 5af3e97..a16f83a 100644 --- a/src/SignatureHelpProvider.php +++ b/src/SignatureHelpProvider.php @@ -58,8 +58,9 @@ class SignatureHelpProvider ) { return new SignatureHelp; } - $count = 0; + $count = null; if ($node instanceof ArgumentExpressionList) { + $count = 0; foreach ($node->getElements() as $param) { $count ++; } @@ -74,9 +75,6 @@ class SignatureHelpProvider if (!$def) { return new SignatureHelp; } - $params = array_map(function ($v) { - return $v->label; - }, $def->parameters); return new SignatureHelp( [ new SignatureInformation( @@ -86,7 +84,7 @@ class SignatureHelpProvider ) ], 0, - $count < count($def->parameters) ? $count : null + $count !== null && $def->parameters !== null && $count < count($def->parameters) ? $count : null ); } } From b2056c1f87d29a937d8eb2d403a834fc9f215d85 Mon Sep 17 00:00:00 2001 From: Ivan Bozhanov Date: Sat, 15 Jul 2017 02:32:48 +0300 Subject: [PATCH 3/8] updated tests --- .../WithReturnTypehints.php.expected.json | 15 ++++++++++----- ...MembersShouldNotBeSymbols.php.expected.json | 3 ++- ...arrayValueShouldBeBoolean.php.expected.json | 6 ++++-- .../cases/caseStatement1.php.expected.json | 3 ++- .../cases/classDefinition1.php.expected.json | 9 ++++++--- .../cases/classProperty1.php.expected.json | 17 +++++++++++++---- .../cases/constants.php.expected.json | 9 ++++++--- .../cases/constants2.php.expected.json | 9 ++++++--- .../cases/constants3.php.expected.json | 9 ++++++--- .../cases/constants4.php.expected.json | 9 ++++++--- .../cases/constants5.php.expected.json | 9 ++++++--- ...ntsInFunctionParamDefault.php.expected.json | 11 +++++++++-- ...ocksOnNamespaceDefinition.php.expected.json | 3 ++- .../cases/exceptions1.php.expected.json | 3 ++- .../cases/ifStatement1.php.expected.json | 3 ++- .../cases/interfaceProperty.php.expected.json | 3 ++- ...icConstantsShouldBeGlobal.php.expected.json | 3 ++- .../cases/magicConsts.php.expected.json | 6 ++++-- .../cases/memberAccess1.php.expected.json | 9 ++++++--- .../cases/memberAccess2.php.expected.json | 9 ++++++--- .../cases/memberAccess3.php.expected.json | 14 +++++++++++--- .../cases/memberAccess4.php.expected.json | 9 ++++++--- .../cases/memberAccess5.php.expected.json | 9 ++++++--- .../cases/memberCall1.php.expected.json | 14 +++++++++++--- .../cases/methodReturnType.php.expected.json | 6 ++++-- .../cases/multipleNamespaces.php.expected.json | 18 ++++++++++++------ ...ultiplePreceedingComments.php.expected.json | 6 ++++-- .../cases/nameToken.php.expected.json | 6 ++++-- .../cases/namespaces2.php.expected.json | 3 ++- .../cases/namespaces5.php.expected.json | 3 ++- .../cases/namespaces6.php.expected.json | 3 ++- .../cases/namespaces8.php.expected.json | 3 ++- .../cases/objectCreation.php.expected.json | 9 ++++++--- .../cases/objectCreation2.php.expected.json | 12 ++++++++---- .../cases/objectCreation3.php.expected.json | 6 ++++-- .../Validation/cases/param1.php.expected.json | 11 +++++++++-- .../Validation/cases/parent1.php.expected.json | 15 ++++++++++----- .../Validation/cases/parent3.php.expected.json | 15 ++++++++++----- .../cases/propertyName1.php.expected.json | 6 ++++-- .../cases/propertyName2.php.expected.json | 6 ++++-- .../cases/returnType.php.expected.json | 11 +++++++++-- .../scopedPropertyAccess.php.expected.json | 9 ++++++--- .../scopedPropertyAccess2.php.expected.json | 3 ++- .../scopedPropertyAccess3.php.expected.json | 6 ++++-- .../scopedPropertyAccess5.php.expected.json | 6 ++++-- tests/Validation/cases/self1.php.expected.json | 15 ++++++++++----- tests/Validation/cases/self2.php.expected.json | 15 ++++++++++----- tests/Validation/cases/self3.php.expected.json | 15 ++++++++++----- tests/Validation/cases/self4.php.expected.json | 9 ++++++--- tests/Validation/cases/self5.php.expected.json | 9 ++++++--- .../Validation/cases/static1.php.expected.json | 15 ++++++++++----- .../Validation/cases/static2.php.expected.json | 15 ++++++++++----- .../Validation/cases/static3.php.expected.json | 15 ++++++++++----- .../Validation/cases/static4.php.expected.json | 9 ++++++--- .../staticMethodReturnType.php.expected.json | 9 ++++++--- .../cases/stringVariable.php.expected.json | 9 ++++++--- ...iedNameOutsideOfNamespace.php.expected.json | 3 ++- ...erifyFqsenOnClassProperty.php.expected.json | 9 ++++++--- 58 files changed, 346 insertions(+), 158 deletions(-) diff --git a/tests/Validation/cases/WithReturnTypehints.php.expected.json b/tests/Validation/cases/WithReturnTypehints.php.expected.json index 26b00e2..38f62ad 100644 --- a/tests/Validation/cases/WithReturnTypehints.php.expected.json +++ b/tests/Validation/cases/WithReturnTypehints.php.expected.json @@ -34,7 +34,8 @@ }, "type": null, "declarationLine": "namespace Fixtures\\Prophecy;", - "documentation": null + "documentation": null, + "parameters": [] }, "Fixtures\\Prophecy\\WithReturnTypehints": { "fqn": "Fixtures\\Prophecy\\WithReturnTypehints", @@ -55,7 +56,8 @@ }, "type": null, "declarationLine": "class WithReturnTypehints extends EmptyClass", - "documentation": null + "documentation": null, + "parameters": [] }, "Fixtures\\Prophecy\\WithReturnTypehints->getSelf()": { "fqn": "Fixtures\\Prophecy\\WithReturnTypehints->getSelf()", @@ -75,7 +77,8 @@ "type__tostring": "\\self", "type": {}, "declarationLine": "public function getSelf(): self {", - "documentation": null + "documentation": null, + "parameters": [] }, "Fixtures\\Prophecy\\WithReturnTypehints->getName()": { "fqn": "Fixtures\\Prophecy\\WithReturnTypehints->getName()", @@ -95,7 +98,8 @@ "type__tostring": "string", "type": {}, "declarationLine": "public function getName(): string {", - "documentation": null + "documentation": null, + "parameters": [] }, "Fixtures\\Prophecy\\WithReturnTypehints->getParent()": { "fqn": "Fixtures\\Prophecy\\WithReturnTypehints->getParent()", @@ -115,7 +119,8 @@ "type__tostring": "\\parent", "type": {}, "declarationLine": "public function getParent(): parent {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/anonymousClassMembersShouldNotBeSymbols.php.expected.json b/tests/Validation/cases/anonymousClassMembersShouldNotBeSymbols.php.expected.json index b0625d7..81a3a89 100644 --- a/tests/Validation/cases/anonymousClassMembersShouldNotBeSymbols.php.expected.json +++ b/tests/Validation/cases/anonymousClassMembersShouldNotBeSymbols.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json b/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json index d58986d..6ca3597 100644 --- a/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json +++ b/tests/Validation/cases/arrayValueShouldBeBoolean.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "A->foo": { "fqn": "A->foo", @@ -38,7 +39,8 @@ "type__tostring": "string[]", "type": {}, "declarationLine": "protected $foo;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/caseStatement1.php.expected.json b/tests/Validation/cases/caseStatement1.php.expected.json index 573dd17..44db846 100644 --- a/tests/Validation/cases/caseStatement1.php.expected.json +++ b/tests/Validation/cases/caseStatement1.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/classDefinition1.php.expected.json b/tests/Validation/cases/classDefinition1.php.expected.json index 6c418b7..4c68232 100644 --- a/tests/Validation/cases/classDefinition1.php.expected.json +++ b/tests/Validation/cases/classDefinition1.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace TestNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "TestNamespace\\A": { "fqn": "TestNamespace\\A", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "TestNamespace\\A->a": { "fqn": "TestNamespace\\A->a", @@ -64,7 +66,8 @@ "type__tostring": "int", "type": {}, "declarationLine": "public $a;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/classProperty1.php.expected.json b/tests/Validation/cases/classProperty1.php.expected.json index e00107e..108ea0a 100644 --- a/tests/Validation/cases/classProperty1.php.expected.json +++ b/tests/Validation/cases/classProperty1.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace TestNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "TestNamespace\\TestClass": { "fqn": "TestNamespace\\TestClass", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class TestClass", - "documentation": null + "documentation": null, + "parameters": [] }, "TestNamespace\\TestClass->testProperty": { "fqn": "TestNamespace\\TestClass->testProperty", @@ -64,7 +66,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public $testProperty;", - "documentation": null + "documentation": null, + "parameters": [] }, "TestNamespace\\TestClass->testMethod()": { "fqn": "TestNamespace\\TestClass->testMethod()", @@ -84,7 +87,13 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public function testMethod($testParameter)", - "documentation": null + "documentation": null, + "parameters": [ + { + "label": "$testParameter", + "documentation": null + } + ] } } } \ No newline at end of file diff --git a/tests/Validation/cases/constants.php.expected.json b/tests/Validation/cases/constants.php.expected.json index d629870..a6eacce 100644 --- a/tests/Validation/cases/constants.php.expected.json +++ b/tests/Validation/cases/constants.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class A", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A::suite()": { "fqn": "MyNamespace\\A::suite()", @@ -64,7 +66,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public static function suite()", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/constants2.php.expected.json b/tests/Validation/cases/constants2.php.expected.json index 66c678f..b88266d 100644 --- a/tests/Validation/cases/constants2.php.expected.json +++ b/tests/Validation/cases/constants2.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class A", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A::suite()": { "fqn": "MyNamespace\\A::suite()", @@ -64,7 +66,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public static function suite()", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/constants3.php.expected.json b/tests/Validation/cases/constants3.php.expected.json index 03f00ba..adc4af6 100644 --- a/tests/Validation/cases/constants3.php.expected.json +++ b/tests/Validation/cases/constants3.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class A", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A::suite()": { "fqn": "MyNamespace\\A::suite()", @@ -64,7 +66,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public static function suite()", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/constants4.php.expected.json b/tests/Validation/cases/constants4.php.expected.json index 62ce430..d23b56b 100644 --- a/tests/Validation/cases/constants4.php.expected.json +++ b/tests/Validation/cases/constants4.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class A", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->suite()": { "fqn": "MyNamespace\\A->suite()", @@ -64,7 +66,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public function suite()", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/constants5.php.expected.json b/tests/Validation/cases/constants5.php.expected.json index bb441c8..8a5ade5 100644 --- a/tests/Validation/cases/constants5.php.expected.json +++ b/tests/Validation/cases/constants5.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\Mbstring": { "fqn": "MyNamespace\\Mbstring", @@ -41,7 +42,8 @@ }, "type": null, "declarationLine": "class Mbstring", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\Mbstring::MB_CASE_FOLD": { "fqn": "MyNamespace\\Mbstring::MB_CASE_FOLD", @@ -61,7 +63,8 @@ "type__tostring": "\\MyNamespace\\PHP_INT_MAX", "type": {}, "declarationLine": "const MB_CASE_FOLD = PHP_INT_MAX;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/constantsInFunctionParamDefault.php.expected.json b/tests/Validation/cases/constantsInFunctionParamDefault.php.expected.json index 8f9a212..13abd53 100644 --- a/tests/Validation/cases/constantsInFunctionParamDefault.php.expected.json +++ b/tests/Validation/cases/constantsInFunctionParamDefault.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "interface A {", - "documentation": null + "documentation": null, + "parameters": [] }, "A->b()": { "fqn": "A->b()", @@ -42,7 +43,13 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b ($a = MY_CONSTANT);", - "documentation": null + "documentation": null, + "parameters": [ + { + "label": "$a = MY_CONSTANT", + "documentation": null + } + ] } } } \ No newline at end of file diff --git a/tests/Validation/cases/docBlocksOnNamespaceDefinition.php.expected.json b/tests/Validation/cases/docBlocksOnNamespaceDefinition.php.expected.json index 73f6bee..c96dbbb 100644 --- a/tests/Validation/cases/docBlocksOnNamespaceDefinition.php.expected.json +++ b/tests/Validation/cases/docBlocksOnNamespaceDefinition.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/exceptions1.php.expected.json b/tests/Validation/cases/exceptions1.php.expected.json index a4a71d1..217cf9f 100644 --- a/tests/Validation/cases/exceptions1.php.expected.json +++ b/tests/Validation/cases/exceptions1.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/ifStatement1.php.expected.json b/tests/Validation/cases/ifStatement1.php.expected.json index 18efe9f..ad8f18f 100644 --- a/tests/Validation/cases/ifStatement1.php.expected.json +++ b/tests/Validation/cases/ifStatement1.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/interfaceProperty.php.expected.json b/tests/Validation/cases/interfaceProperty.php.expected.json index 178834d..477ce27 100644 --- a/tests/Validation/cases/interfaceProperty.php.expected.json +++ b/tests/Validation/cases/interfaceProperty.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "interface A {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/magicConstantsShouldBeGlobal.php.expected.json b/tests/Validation/cases/magicConstantsShouldBeGlobal.php.expected.json index f62d214..f0c8980 100644 --- a/tests/Validation/cases/magicConstantsShouldBeGlobal.php.expected.json +++ b/tests/Validation/cases/magicConstantsShouldBeGlobal.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace B;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/magicConsts.php.expected.json b/tests/Validation/cases/magicConsts.php.expected.json index a37791b..4891340 100644 --- a/tests/Validation/cases/magicConsts.php.expected.json +++ b/tests/Validation/cases/magicConsts.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "A::$deprecationsTriggered": { "fqn": "A::$deprecationsTriggered", @@ -42,7 +43,8 @@ "type__tostring": "\\__CLASS__[]", "type": {}, "declarationLine": "private static $deprecationsTriggered;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/memberAccess1.php.expected.json b/tests/Validation/cases/memberAccess1.php.expected.json index 7f9630a..495705e 100644 --- a/tests/Validation/cases/memberAccess1.php.expected.json +++ b/tests/Validation/cases/memberAccess1.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A::a()": { "fqn": "MyNamespace\\A::a()", @@ -64,7 +66,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "static function a() {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/memberAccess2.php.expected.json b/tests/Validation/cases/memberAccess2.php.expected.json index 7b3ce1d..feaf70b 100644 --- a/tests/Validation/cases/memberAccess2.php.expected.json +++ b/tests/Validation/cases/memberAccess2.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A::a()": { "fqn": "MyNamespace\\A::a()", @@ -64,7 +66,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "static function a() {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/memberAccess3.php.expected.json b/tests/Validation/cases/memberAccess3.php.expected.json index 520dae8..1495343 100644 --- a/tests/Validation/cases/memberAccess3.php.expected.json +++ b/tests/Validation/cases/memberAccess3.php.expected.json @@ -40,7 +40,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -59,7 +60,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A::getInitializer()": { "fqn": "MyNamespace\\A::getInitializer()", @@ -79,7 +81,13 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public static function getInitializer(ClassLoader $loader)", - "documentation": null + "documentation": null, + "parameters": [ + { + "label": "ClassLoader $loader", + "documentation": null + } + ] } } } \ No newline at end of file diff --git a/tests/Validation/cases/memberAccess4.php.expected.json b/tests/Validation/cases/memberAccess4.php.expected.json index 1d51b85..4bf8887 100644 --- a/tests/Validation/cases/memberAccess4.php.expected.json +++ b/tests/Validation/cases/memberAccess4.php.expected.json @@ -31,7 +31,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -50,7 +51,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->testRequest()": { "fqn": "MyNamespace\\A->testRequest()", @@ -70,7 +72,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public function testRequest()", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/memberAccess5.php.expected.json b/tests/Validation/cases/memberAccess5.php.expected.json index 57aca0a..9575bdc 100644 --- a/tests/Validation/cases/memberAccess5.php.expected.json +++ b/tests/Validation/cases/memberAccess5.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\ParseErrorsTest": { "fqn": "MyNamespace\\ParseErrorsTest", @@ -41,7 +42,8 @@ }, "type": null, "declarationLine": "class ParseErrorsTest {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\ParseErrorsTest->setUp()": { "fqn": "MyNamespace\\ParseErrorsTest->setUp()", @@ -61,7 +63,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public function setUp()", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/memberCall1.php.expected.json b/tests/Validation/cases/memberCall1.php.expected.json index 416a705..b44651e 100644 --- a/tests/Validation/cases/memberCall1.php.expected.json +++ b/tests/Validation/cases/memberCall1.php.expected.json @@ -28,7 +28,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\ParseErrorsTest": { "fqn": "MyNamespace\\ParseErrorsTest", @@ -47,7 +48,8 @@ }, "type": null, "declarationLine": "class ParseErrorsTest", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\ParseErrorsTest->setAccount()": { "fqn": "MyNamespace\\ParseErrorsTest->setAccount()", @@ -67,7 +69,13 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public function setAccount(AccountInterface $account)", - "documentation": null + "documentation": null, + "parameters": [ + { + "label": "AccountInterface $account", + "documentation": null + } + ] } } } \ No newline at end of file diff --git a/tests/Validation/cases/methodReturnType.php.expected.json b/tests/Validation/cases/methodReturnType.php.expected.json index 54d79d6..f7a8a6d 100644 --- a/tests/Validation/cases/methodReturnType.php.expected.json +++ b/tests/Validation/cases/methodReturnType.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "class FooClass {", - "documentation": null + "documentation": null, + "parameters": [] }, "FooClass->foo()": { "fqn": "FooClass->foo()", @@ -42,7 +43,8 @@ "type__tostring": "\\FooClass", "type": {}, "declarationLine": "public function foo(): FooClass {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/multipleNamespaces.php.expected.json b/tests/Validation/cases/multipleNamespaces.php.expected.json index 30fe596..78ffade 100644 --- a/tests/Validation/cases/multipleNamespaces.php.expected.json +++ b/tests/Validation/cases/multipleNamespaces.php.expected.json @@ -31,7 +31,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace1;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace1\\B": { "fqn": "MyNamespace1\\B", @@ -50,7 +51,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace1\\B->b()": { "fqn": "MyNamespace1\\B->b()", @@ -70,7 +72,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace2": { "fqn": "MyNamespace2", @@ -89,7 +92,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace2;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace2\\A": { "fqn": "MyNamespace2\\A", @@ -110,7 +114,8 @@ }, "type": null, "declarationLine": "class A extends MyNamespace1\\B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace2\\A->a()": { "fqn": "MyNamespace2\\A->a()", @@ -130,7 +135,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/multiplePreceedingComments.php.expected.json b/tests/Validation/cases/multiplePreceedingComments.php.expected.json index 5ca3dd7..abbda57 100644 --- a/tests/Validation/cases/multiplePreceedingComments.php.expected.json +++ b/tests/Validation/cases/multiplePreceedingComments.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "class Foo", - "documentation": null + "documentation": null, + "parameters": [] }, "Foo->fn()": { "fqn": "Foo->fn()", @@ -38,7 +39,8 @@ "type__tostring": "\\Iterator", "type": {}, "declarationLine": "public function fn()", - "documentation": "Foo" + "documentation": "Foo", + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/nameToken.php.expected.json b/tests/Validation/cases/nameToken.php.expected.json index 0ecd53f..ec61668 100644 --- a/tests/Validation/cases/nameToken.php.expected.json +++ b/tests/Validation/cases/nameToken.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "A->b()": { "fqn": "A->b()", @@ -38,7 +39,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/namespaces2.php.expected.json b/tests/Validation/cases/namespaces2.php.expected.json index 42243e5..b4cbeb3 100644 --- a/tests/Validation/cases/namespaces2.php.expected.json +++ b/tests/Validation/cases/namespaces2.php.expected.json @@ -31,7 +31,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace1;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/namespaces5.php.expected.json b/tests/Validation/cases/namespaces5.php.expected.json index 5ffe02d..dd87435 100644 --- a/tests/Validation/cases/namespaces5.php.expected.json +++ b/tests/Validation/cases/namespaces5.php.expected.json @@ -40,7 +40,8 @@ }, "type": null, "declarationLine": "namespace B;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/namespaces6.php.expected.json b/tests/Validation/cases/namespaces6.php.expected.json index 1657f28..676e0b7 100644 --- a/tests/Validation/cases/namespaces6.php.expected.json +++ b/tests/Validation/cases/namespaces6.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "namespace A \\ B;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/namespaces8.php.expected.json b/tests/Validation/cases/namespaces8.php.expected.json index 71017d9..1164a7a 100644 --- a/tests/Validation/cases/namespaces8.php.expected.json +++ b/tests/Validation/cases/namespaces8.php.expected.json @@ -28,7 +28,8 @@ }, "type": null, "declarationLine": "namespace LanguageServer\\Tests\\Utils;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/objectCreation.php.expected.json b/tests/Validation/cases/objectCreation.php.expected.json index a8fce0f..9348202 100644 --- a/tests/Validation/cases/objectCreation.php.expected.json +++ b/tests/Validation/cases/objectCreation.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -41,7 +42,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -61,7 +63,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/objectCreation2.php.expected.json b/tests/Validation/cases/objectCreation2.php.expected.json index 2ec8314..99d25b2 100644 --- a/tests/Validation/cases/objectCreation2.php.expected.json +++ b/tests/Validation/cases/objectCreation2.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B": { "fqn": "MyNamespace\\B", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -63,7 +65,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -83,7 +86,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/objectCreation3.php.expected.json b/tests/Validation/cases/objectCreation3.php.expected.json index f0cc31a..419d60a 100644 --- a/tests/Validation/cases/objectCreation3.php.expected.json +++ b/tests/Validation/cases/objectCreation3.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "A->a()": { "fqn": "A->a()", @@ -42,7 +43,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/param1.php.expected.json b/tests/Validation/cases/param1.php.expected.json index 33c99db..1df2011 100644 --- a/tests/Validation/cases/param1.php.expected.json +++ b/tests/Validation/cases/param1.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\init()": { "fqn": "MyNamespace\\init()", @@ -42,7 +43,13 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function init(Hi $view)", - "documentation": null + "documentation": null, + "parameters": [ + { + "label": "Hi $view", + "documentation": null + } + ] } } } \ No newline at end of file diff --git a/tests/Validation/cases/parent1.php.expected.json b/tests/Validation/cases/parent1.php.expected.json index eab232e..7667ced 100644 --- a/tests/Validation/cases/parent1.php.expected.json +++ b/tests/Validation/cases/parent1.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B": { "fqn": "MyNamespace\\B", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B->b()": { "fqn": "MyNamespace\\B->b()", @@ -64,7 +66,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -85,7 +88,8 @@ }, "type": null, "declarationLine": "class A extends B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -105,7 +109,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/parent3.php.expected.json b/tests/Validation/cases/parent3.php.expected.json index aedb4b2..fd05c70 100644 --- a/tests/Validation/cases/parent3.php.expected.json +++ b/tests/Validation/cases/parent3.php.expected.json @@ -28,7 +28,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B": { "fqn": "MyNamespace\\B", @@ -47,7 +48,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B->b()": { "fqn": "MyNamespace\\B->b()", @@ -67,7 +69,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -88,7 +91,8 @@ }, "type": null, "declarationLine": "class A extends B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -108,7 +112,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/propertyName1.php.expected.json b/tests/Validation/cases/propertyName1.php.expected.json index 42b2ee9..fbfbf21 100644 --- a/tests/Validation/cases/propertyName1.php.expected.json +++ b/tests/Validation/cases/propertyName1.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "class MyClass", - "documentation": null + "documentation": null, + "parameters": [] }, "MyClass->mainPropertyName": { "fqn": "MyClass->mainPropertyName", @@ -38,7 +39,8 @@ "type__tostring": "string", "type": {}, "declarationLine": "protected $mainPropertyName;", - "documentation": "The name of the main property, or NULL if there is none." + "documentation": "The name of the main property, or NULL if there is none.", + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/propertyName2.php.expected.json b/tests/Validation/cases/propertyName2.php.expected.json index 5a5c914..b52dc6c 100644 --- a/tests/Validation/cases/propertyName2.php.expected.json +++ b/tests/Validation/cases/propertyName2.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "class MyClass", - "documentation": null + "documentation": null, + "parameters": [] }, "MyClass->mainPropertyName": { "fqn": "MyClass->mainPropertyName", @@ -38,7 +39,8 @@ "type__tostring": "string", "type": {}, "declarationLine": "protected $mainPropertyName;", - "documentation": "The name of the main property, or NULL if there is none." + "documentation": "The name of the main property, or NULL if there is none.", + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/returnType.php.expected.json b/tests/Validation/cases/returnType.php.expected.json index cf9cc63..6ec6bf4 100644 --- a/tests/Validation/cases/returnType.php.expected.json +++ b/tests/Validation/cases/returnType.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace TestNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "TestNamespace\\whatever()": { "fqn": "TestNamespace\\whatever()", @@ -45,7 +46,13 @@ "type__tostring": "\\TestNamespace\\TestClass", "type": {}, "declarationLine": "function whatever(TestClass $param): TestClass2 {", - "documentation": "Aute duis elit reprehenderit tempor cillum proident anim laborum eu laboris reprehenderit ea incididunt." + "documentation": "Aute duis elit reprehenderit tempor cillum proident anim laborum eu laboris reprehenderit ea incididunt.", + "parameters": [ + { + "label": "TestClass $param", + "documentation": "Adipisicing non non cillum sint incididunt cillum enim mollit." + } + ] } } } \ No newline at end of file diff --git a/tests/Validation/cases/scopedPropertyAccess.php.expected.json b/tests/Validation/cases/scopedPropertyAccess.php.expected.json index 52b6e7a..7d2a14f 100644 --- a/tests/Validation/cases/scopedPropertyAccess.php.expected.json +++ b/tests/Validation/cases/scopedPropertyAccess.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -44,7 +45,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A::a()": { "fqn": "MyNamespace\\A::a()", @@ -64,7 +66,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "static function a() {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/scopedPropertyAccess2.php.expected.json b/tests/Validation/cases/scopedPropertyAccess2.php.expected.json index e5f6850..5796f1a 100644 --- a/tests/Validation/cases/scopedPropertyAccess2.php.expected.json +++ b/tests/Validation/cases/scopedPropertyAccess2.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/scopedPropertyAccess3.php.expected.json b/tests/Validation/cases/scopedPropertyAccess3.php.expected.json index aa508bc..c67bae2 100644 --- a/tests/Validation/cases/scopedPropertyAccess3.php.expected.json +++ b/tests/Validation/cases/scopedPropertyAccess3.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "class A {", - "documentation": null + "documentation": null, + "parameters": [] }, "A::$a": { "fqn": "A::$a", @@ -45,7 +46,8 @@ "type__tostring": "string", "type": {}, "declarationLine": "static $a;", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/scopedPropertyAccess5.php.expected.json b/tests/Validation/cases/scopedPropertyAccess5.php.expected.json index bd4ee70..2435e0b 100644 --- a/tests/Validation/cases/scopedPropertyAccess5.php.expected.json +++ b/tests/Validation/cases/scopedPropertyAccess5.php.expected.json @@ -31,7 +31,8 @@ }, "type": null, "declarationLine": "class TestClass implements TestInterface {", - "documentation": null + "documentation": null, + "parameters": [] }, "TestClass::$testProperty": { "fqn": "TestClass::$testProperty", @@ -51,7 +52,8 @@ "type__tostring": "\\TestClass[]", "type": {}, "declarationLine": "public static $testProperty;", - "documentation": "Lorem excepteur officia sit anim velit veniam enim." + "documentation": "Lorem excepteur officia sit anim velit veniam enim.", + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/self1.php.expected.json b/tests/Validation/cases/self1.php.expected.json index eb37fc7..51fe0b1 100644 --- a/tests/Validation/cases/self1.php.expected.json +++ b/tests/Validation/cases/self1.php.expected.json @@ -28,7 +28,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B": { "fqn": "MyNamespace\\B", @@ -47,7 +48,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B->b()": { "fqn": "MyNamespace\\B->b()", @@ -67,7 +69,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -88,7 +91,8 @@ }, "type": null, "declarationLine": "class A extends B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -108,7 +112,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/self2.php.expected.json b/tests/Validation/cases/self2.php.expected.json index 2280b1a..cb4b963 100644 --- a/tests/Validation/cases/self2.php.expected.json +++ b/tests/Validation/cases/self2.php.expected.json @@ -28,7 +28,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B": { "fqn": "MyNamespace\\B", @@ -47,7 +48,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B->b()": { "fqn": "MyNamespace\\B->b()", @@ -67,7 +69,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -88,7 +91,8 @@ }, "type": null, "declarationLine": "class A extends B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -108,7 +112,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/self3.php.expected.json b/tests/Validation/cases/self3.php.expected.json index 3f69299..88a053d 100644 --- a/tests/Validation/cases/self3.php.expected.json +++ b/tests/Validation/cases/self3.php.expected.json @@ -28,7 +28,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B": { "fqn": "MyNamespace\\B", @@ -47,7 +48,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B->b()": { "fqn": "MyNamespace\\B->b()", @@ -67,7 +69,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -88,7 +91,8 @@ }, "type": null, "declarationLine": "class A extends B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -108,7 +112,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/self4.php.expected.json b/tests/Validation/cases/self4.php.expected.json index ec3ae07..5851998 100644 --- a/tests/Validation/cases/self4.php.expected.json +++ b/tests/Validation/cases/self4.php.expected.json @@ -37,7 +37,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -56,7 +57,8 @@ }, "type": null, "declarationLine": "class A", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A::suite()": { "fqn": "MyNamespace\\A::suite()", @@ -76,7 +78,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public static function suite()", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/self5.php.expected.json b/tests/Validation/cases/self5.php.expected.json index 6727689..6486be9 100644 --- a/tests/Validation/cases/self5.php.expected.json +++ b/tests/Validation/cases/self5.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -41,7 +42,8 @@ }, "type": null, "declarationLine": "class A", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->typesProvider()": { "fqn": "MyNamespace\\A->typesProvider()", @@ -61,7 +63,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public function typesProvider()", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/static1.php.expected.json b/tests/Validation/cases/static1.php.expected.json index 69f8de0..807c27d 100644 --- a/tests/Validation/cases/static1.php.expected.json +++ b/tests/Validation/cases/static1.php.expected.json @@ -28,7 +28,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B": { "fqn": "MyNamespace\\B", @@ -47,7 +48,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B->b()": { "fqn": "MyNamespace\\B->b()", @@ -67,7 +69,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -88,7 +91,8 @@ }, "type": null, "declarationLine": "class A extends B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -108,7 +112,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/static2.php.expected.json b/tests/Validation/cases/static2.php.expected.json index 17f9a66..f0a3686 100644 --- a/tests/Validation/cases/static2.php.expected.json +++ b/tests/Validation/cases/static2.php.expected.json @@ -28,7 +28,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B": { "fqn": "MyNamespace\\B", @@ -47,7 +48,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B->b()": { "fqn": "MyNamespace\\B->b()", @@ -67,7 +69,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -88,7 +91,8 @@ }, "type": null, "declarationLine": "class A extends B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -108,7 +112,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/static3.php.expected.json b/tests/Validation/cases/static3.php.expected.json index f6e5189..272ecc3 100644 --- a/tests/Validation/cases/static3.php.expected.json +++ b/tests/Validation/cases/static3.php.expected.json @@ -28,7 +28,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B": { "fqn": "MyNamespace\\B", @@ -47,7 +48,8 @@ }, "type": null, "declarationLine": "class B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\B->b()": { "fqn": "MyNamespace\\B->b()", @@ -67,7 +69,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function b() {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -88,7 +91,8 @@ }, "type": null, "declarationLine": "class A extends B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -108,7 +112,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/static4.php.expected.json b/tests/Validation/cases/static4.php.expected.json index 3d05ede..7376336 100644 --- a/tests/Validation/cases/static4.php.expected.json +++ b/tests/Validation/cases/static4.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "namespace MyNamespace;", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A": { "fqn": "MyNamespace\\A", @@ -43,7 +44,8 @@ }, "type": null, "declarationLine": "class A extends B {", - "documentation": null + "documentation": null, + "parameters": [] }, "MyNamespace\\A->a()": { "fqn": "MyNamespace\\A->a()", @@ -63,7 +65,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/staticMethodReturnType.php.expected.json b/tests/Validation/cases/staticMethodReturnType.php.expected.json index c178f0a..d9d4dcd 100644 --- a/tests/Validation/cases/staticMethodReturnType.php.expected.json +++ b/tests/Validation/cases/staticMethodReturnType.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "class FooClass {", - "documentation": null + "documentation": null, + "parameters": [] }, "FooClass::staticFoo()": { "fqn": "FooClass::staticFoo()", @@ -42,7 +43,8 @@ "type__tostring": "\\FooClass", "type": {}, "declarationLine": "public static function staticFoo(): FooClass {", - "documentation": null + "documentation": null, + "parameters": [] }, "FooClass->bar()": { "fqn": "FooClass->bar()", @@ -62,7 +64,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public function bar() { }", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/stringVariable.php.expected.json b/tests/Validation/cases/stringVariable.php.expected.json index 61669c8..ba25595 100644 --- a/tests/Validation/cases/stringVariable.php.expected.json +++ b/tests/Validation/cases/stringVariable.php.expected.json @@ -18,7 +18,8 @@ }, "type": null, "declarationLine": "class B", - "documentation": null + "documentation": null, + "parameters": [] }, "B->hi": { "fqn": "B->hi", @@ -38,7 +39,8 @@ "type__tostring": "int", "type": {}, "declarationLine": "public $hi;", - "documentation": null + "documentation": null, + "parameters": [] }, "B->a()": { "fqn": "B->a()", @@ -58,7 +60,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "function a () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/testQualifiedNameOutsideOfNamespace.php.expected.json b/tests/Validation/cases/testQualifiedNameOutsideOfNamespace.php.expected.json index f686093..43d06b4 100644 --- a/tests/Validation/cases/testQualifiedNameOutsideOfNamespace.php.expected.json +++ b/tests/Validation/cases/testQualifiedNameOutsideOfNamespace.php.expected.json @@ -22,7 +22,8 @@ }, "type": null, "declarationLine": "namespace SomeNamespace { }", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file diff --git a/tests/Validation/cases/verifyFqsenOnClassProperty.php.expected.json b/tests/Validation/cases/verifyFqsenOnClassProperty.php.expected.json index f6851bf..81560bf 100644 --- a/tests/Validation/cases/verifyFqsenOnClassProperty.php.expected.json +++ b/tests/Validation/cases/verifyFqsenOnClassProperty.php.expected.json @@ -25,7 +25,8 @@ }, "type": null, "declarationLine": "class Foo {", - "documentation": null + "documentation": null, + "parameters": [] }, "Foo->bar": { "fqn": "Foo->bar", @@ -45,7 +46,8 @@ "type__tostring": "\\", "type": {}, "declarationLine": "protected $bar;", - "documentation": null + "documentation": null, + "parameters": [] }, "Foo->foo()": { "fqn": "Foo->foo()", @@ -65,7 +67,8 @@ "type__tostring": "mixed", "type": {}, "declarationLine": "public function foo () {", - "documentation": null + "documentation": null, + "parameters": [] } } } \ No newline at end of file From 1c714f98b713fe96250238472cb39dc2f660c40f Mon Sep 17 00:00:00 2001 From: Ivan Bozhanov Date: Sat, 15 Jul 2017 03:07:53 +0300 Subject: [PATCH 4/8] improved param counting --- fixtures/signature/methodActiveParam.php | 15 +++++++++++ src/SignatureHelpProvider.php | 5 ++++ .../Server/TextDocument/SignatureHelpTest.php | 26 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 fixtures/signature/methodActiveParam.php diff --git a/fixtures/signature/methodActiveParam.php b/fixtures/signature/methodActiveParam.php new file mode 100644 index 0000000..c100c7a --- /dev/null +++ b/fixtures/signature/methodActiveParam.php @@ -0,0 +1,15 @@ +method(); + } +} + +$a = new HelpClass5; +$a->method("asdf", 123, true); \ No newline at end of file diff --git a/src/SignatureHelpProvider.php b/src/SignatureHelpProvider.php index a16f83a..18cc1a8 100644 --- a/src/SignatureHelpProvider.php +++ b/src/SignatureHelpProvider.php @@ -46,12 +46,14 @@ class SignatureHelpProvider public function provideSignature(PhpDocument $doc, Position $pos) : SignatureHelp { $node = $doc->getNodeAtPosition($pos); + $nodes = [$node]; while ($node && !($node instanceof ArgumentExpressionList) && !($node instanceof CallExpression) && $node->parent ) { $node = $node->parent; + $nodes[] = $node; } if (!($node instanceof ArgumentExpressionList) && !($node instanceof CallExpression) @@ -62,6 +64,9 @@ class SignatureHelpProvider if ($node instanceof ArgumentExpressionList) { $count = 0; foreach ($node->getElements() as $param) { + if (in_array($param, $nodes)) { + break; + } $count ++; } while ($node && !($node instanceof CallExpression) && $node->parent) { diff --git a/tests/Server/TextDocument/SignatureHelpTest.php b/tests/Server/TextDocument/SignatureHelpTest.php index 76613e1..832a88e 100644 --- a/tests/Server/TextDocument/SignatureHelpTest.php +++ b/tests/Server/TextDocument/SignatureHelpTest.php @@ -219,4 +219,30 @@ class SignatureHelpTest extends TestCase ] ), $result); } + + public function testMethodActiveParam() + { + $completionUri = pathToUri(__DIR__ . '/../../../fixtures/signature/methodActiveParam.php'); + $this->loader->open($completionUri, file_get_contents($completionUri)); + $result = $this->textDocument->signatureHelp( + new TextDocumentIdentifier($completionUri), + new Position(14, 21) + )->wait(); + + $this->assertEquals(new SignatureHelp( + [ + new SignatureInformation( + 'method(string $param = "", int $count = 0, bool $test = null)', + null, + [ + new ParameterInformation('string $param = ""'), + new ParameterInformation('int $count = 0'), + new ParameterInformation('bool $test = null') + ] + ) + ], + 0, + 1 + ), $result); + } } From f84b6a48b6102ef43954900f42e9ff264973b3f6 Mon Sep 17 00:00:00 2001 From: Ivan Bozhanov Date: Sat, 15 Jul 2017 03:17:32 +0300 Subject: [PATCH 5/8] optimized param count calculation --- src/SignatureHelpProvider.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SignatureHelpProvider.php b/src/SignatureHelpProvider.php index 18cc1a8..84a3010 100644 --- a/src/SignatureHelpProvider.php +++ b/src/SignatureHelpProvider.php @@ -5,6 +5,7 @@ namespace LanguageServer; use Microsoft\PhpParser\Node\DelimitedList\ArgumentExpressionList; use Microsoft\PhpParser\Node\Expression\CallExpression; +use Microsoft\PhpParser\Node\Expression\ArgumentExpression; use LanguageServer\Index\ReadableIndex; use LanguageServer\Protocol\{ Range, @@ -46,14 +47,16 @@ class SignatureHelpProvider public function provideSignature(PhpDocument $doc, Position $pos) : SignatureHelp { $node = $doc->getNodeAtPosition($pos); - $nodes = [$node]; + $arge = null; while ($node && !($node instanceof ArgumentExpressionList) && !($node instanceof CallExpression) && $node->parent ) { + if ($node instanceof ArgumentExpression) { + $arge = $node; + } $node = $node->parent; - $nodes[] = $node; } if (!($node instanceof ArgumentExpressionList) && !($node instanceof CallExpression) @@ -64,7 +67,7 @@ class SignatureHelpProvider if ($node instanceof ArgumentExpressionList) { $count = 0; foreach ($node->getElements() as $param) { - if (in_array($param, $nodes)) { + if ($param === $arge) { break; } $count ++; From 7b54ecd67c10da18b393a2b0e7a74e8a8f508623 Mon Sep 17 00:00:00 2001 From: Ivan Bozhanov Date: Sat, 15 Jul 2017 18:25:16 +0300 Subject: [PATCH 6/8] updated docs and comments --- src/Definition.php | 1 + src/DefinitionResolver.php | 2 -- src/Server/TextDocument.php | 8 ++++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Definition.php b/src/Definition.php index 12db9c1..5d62181 100644 --- a/src/Definition.php +++ b/src/Definition.php @@ -98,6 +98,7 @@ class Definition * @var string */ public $documentation; + /** * Parameters array (for methods and functions), for use in textDocument/signatureHelp * diff --git a/src/DefinitionResolver.php b/src/DefinitionResolver.php index bf63452..1ae4cf4 100644 --- a/src/DefinitionResolver.php +++ b/src/DefinitionResolver.php @@ -238,10 +238,8 @@ class DefinitionResolver $def->parameters = []; if (property_exists($node, 'parameters') && $node->parameters) { foreach ($node->parameters->getElements() as $param) { - //var_dump($param); die(); $def->parameters[] = new ParameterInformation( $this->getDeclarationLineFromNode($param), - //$param->getName(), // TODO: rebuild this $this->getDocumentationFromNode($param) ); } diff --git a/src/Server/TextDocument.php b/src/Server/TextDocument.php index e936cf8..7274213 100644 --- a/src/Server/TextDocument.php +++ b/src/Server/TextDocument.php @@ -417,6 +417,14 @@ class TextDocument }); } + /** + * The signature help request is sent from the client to the server to request signature information + * at a given cursor position. + * + * @param TextDocumentIdentifier $textDocument The text document + * @param Position $position The position inside the text document + * @return Promise + */ public function signatureHelp(TextDocumentIdentifier $textDocument, Position $position): Promise { return coroutine(function () use ($textDocument, $position) { From 7d64f060e8d2f050d55a820fe9d9a01c132c32e8 Mon Sep 17 00:00:00 2001 From: Ivan Bozhanov Date: Sat, 15 Jul 2017 21:44:49 +0300 Subject: [PATCH 7/8] moved short declaration extraction to a separate function --- src/SignatureHelpProvider.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/SignatureHelpProvider.php b/src/SignatureHelpProvider.php index 84a3010..916d177 100644 --- a/src/SignatureHelpProvider.php +++ b/src/SignatureHelpProvider.php @@ -37,6 +37,19 @@ class SignatureHelpProvider $this->index = $index; } + /** + * Get the short declaration for a callable (class modifiers, function keyword, etc are stripped) + * + * @param string $declaration + * @return string + */ + protected function getShortDeclaration(string $declaration): string + { + $parts = explode('(', $declaration, 2); + $name = array_reverse(explode(' ', trim($parts[0])))[0]; + return $name . '(' . $parts[1]; + } + /** * Returns signature help for a specific cursor position in a document * @@ -86,7 +99,7 @@ class SignatureHelpProvider return new SignatureHelp( [ new SignatureInformation( - trim(str_replace(['public', 'protected', 'private', 'function', 'static'], '', $def->declarationLine)), + $this->getShortDeclaration($def->declarationLine), $def->documentation, $def->parameters ) From b5bfaa98774d0d4a283de5a3472c5f575b7cebc6 Mon Sep 17 00:00:00 2001 From: Ivan Bozhanov Date: Sat, 15 Jul 2017 22:03:09 +0300 Subject: [PATCH 8/8] switched from property_exists to instanceof --- src/DefinitionResolver.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DefinitionResolver.php b/src/DefinitionResolver.php index 1ae4cf4..24e3cbf 100644 --- a/src/DefinitionResolver.php +++ b/src/DefinitionResolver.php @@ -8,6 +8,9 @@ use LanguageServer\Protocol\SymbolInformation; use LanguageServer\Protocol\ParameterInformation; use Microsoft\PhpParser; use Microsoft\PhpParser\Node; +use Microsoft\PhpParser\Node\Expression\AnonymousFunctionCreationExpression; +use Microsoft\PhpParser\Node\MethodDeclaration; +use Microsoft\PhpParser\Node\Statement\FunctionDeclaration; use phpDocumentor\Reflection\{ DocBlock, DocBlockFactory, Fqsen, Type, TypeResolver, Types }; @@ -236,7 +239,11 @@ class DefinitionResolver } $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) { $def->parameters[] = new ParameterInformation( $this->getDeclarationLineFromNode($param),