Skip to content

Resolve expressions recursively #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Nov 18, 2016
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"LanguageServer\\": "src/"
},
"files" : [
"src/utils.php",
"src/Fqn.php"
"src/utils.php"
]
},
"autoload-dev": {
Expand Down
4 changes: 4 additions & 0 deletions fixtures/global_references.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ function whatever(TestClass $param): TestClass {
if ($abc instanceof TestInterface) {

}

// Nested expression
$obj->testProperty->testMethod();
TestClass::$staticTestProperty[123]->testProperty;
2 changes: 1 addition & 1 deletion fixtures/global_symbols.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TestClass implements TestInterface
/**
* Lorem excepteur officia sit anim velit veniam enim.
*
* @var TestClass
* @var TestClass[]
*/
public static $staticTestProperty;

Expand Down
4 changes: 4 additions & 0 deletions fixtures/references.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ function whatever(TestClass $param): TestClass {
if ($abc instanceof TestInterface) {

}

// Nested expressions
$obj->testProperty->testMethod();
TestClass::$staticTestProperty[123]->testProperty;
2 changes: 1 addition & 1 deletion fixtures/symbols.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TestClass implements TestInterface
/**
* Lorem excepteur officia sit anim velit veniam enim.
*
* @var TestClass
* @var TestClass[]
*/
public static $staticTestProperty;

Expand Down
62 changes: 62 additions & 0 deletions src/Definition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
declare(strict_types = 1);

namespace LanguageServer;

use PhpParser\Node;
use phpDocumentor\Reflection\{Types, Type, Fqsen, TypeResolver};
use LanguageServer\Protocol\SymbolInformation;
use Exception;

/**
* Class used to represent symbols
*/
class Definition
{
/**
* The fully qualified name of the symbol, if it has one
*
* Examples of FQNs:
* - testFunction()
* - TestNamespace\TestClass
* - TestNamespace\TestClass::TEST_CONSTANT
* - TestNamespace\TestClass::staticTestProperty
* - TestNamespace\TestClass::testProperty
* - TestNamespace\TestClass::staticTestMethod()
* - TestNamespace\TestClass::testMethod()
*
* @var string|null
*/
public $fqn;

/**
* @var Protocol\SymbolInformation
*/
public $symbolInformation;

/**
* The type a reference to this symbol will resolve to.
* For properties and constants, this is the type of the property/constant.
* For functions and methods, this is the return type.
* For any other declaration it will be null.
* Can also be a compound type.
* If it is unknown, will be Types\Mixed.
*
* @var \phpDocumentor\Type|null
*/
public $type;

/**
* The first line of the declaration, for use in textDocument/hover
*
* @var string
*/
public $declarationLine;

/**
* A documentation string, for use in textDocument/hover
*
* @var string
*/
public $documentation;
}
Loading