1
0
Fork 0
pull/416/head
jens1o 2017-06-17 11:24:40 +02:00
commit 8404b5de73
81 changed files with 779 additions and 223 deletions

View File

@ -38,7 +38,7 @@
"sabre/uri": "^2.0",
"jetbrains/phpstorm-stubs": "dev-master",
"composer/composer": "^1.3",
"Microsoft/tolerant-php-parser": "^0.0.2"
"Microsoft/tolerant-php-parser": "^0.0.3"
},
"minimum-stability": "dev",
"prefer-stable": true,

View File

@ -0,0 +1,11 @@
<?php
namespace MyNamespace;
class SomeClass
{
public function someMethod()
{
tes
}
}

View File

@ -0,0 +1,11 @@
<?php
class FooClass {
public function foo(): FooClass {
return $this;
}
}
$fc = new FooClass();
$foo = $fc->foo();
$foo->

View File

@ -0,0 +1,12 @@
<?php
class FooClass {
public static function staticFoo(): FooClass {
return new FooClass();
}
public function bar() { }
}
$foo = FooClass::staticFoo();
$foo->

View File

@ -105,3 +105,15 @@ class ChildClass extends TestClass {}
define('TEST_DEFINE_CONSTANT', false);
print TEST_DEFINE_CONSTANT ? 'true' : 'false';
/**
* Neither this class nor its members are referenced anywhere
*/
class UnusedClass
{
public $unusedProperty;
public function unusedMethod()
{
}
}

View File

@ -7,5 +7,7 @@
<exclude name="PSR2.Namespaces.UseDeclaration.MultipleDeclarations"/>
<exclude name="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed"/>
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
</rule>
</ruleset>

View File

@ -49,6 +49,7 @@ class CompletionProvider
'eval',
'exit',
'extends',
'false',
'final',
'finally',
'for',
@ -67,6 +68,7 @@ class CompletionProvider
'list',
'namespace',
'new',
'null',
'or',
'print',
'private',
@ -79,6 +81,7 @@ class CompletionProvider
'switch',
'throw',
'trait',
'true',
'try',
'unset',
'use',
@ -125,6 +128,7 @@ class CompletionProvider
// This can be made much more performant if the tree follows specific invariants.
$node = $doc->getNodeAtPosition($pos);
// Get the node at the position under the cursor
$offset = $node === null ? -1 : $pos->toOffset($node->getFileContents());
if (
$node !== null
@ -145,22 +149,31 @@ class CompletionProvider
$node = $node->parent;
}
// Inspect the type of expression under the cursor
if ($node === null || $node instanceof Node\Statement\InlineHtml || $pos == new Position(0, 0)) {
// HTML, beginning of file
// Inside HTML and at the beginning of the file, propose <?php
$item = new CompletionItem('<?php', CompletionItemKind::KEYWORD);
$item->textEdit = new TextEdit(
new Range($pos, $pos),
stripStringOverlap($doc->getRange(new Range(new Position(0, 0), $pos)), '<?php')
);
$list->items[] = $item;
} /*
VARIABLES */
elseif (
$node instanceof Node\Expression\Variable &&
!(
$node->parent instanceof Node\Expression\ScopedPropertyAccessExpression &&
$node->parent->memberName === $node)
} elseif (
$node instanceof Node\Expression\Variable
&& !(
$node->parent instanceof Node\Expression\ScopedPropertyAccessExpression
&& $node->parent->memberName === $node
)
) {
// Variables
//
// $|
// $a|
// Find variables, parameters and use statements in the scope
$namePrefix = $node->getName() ?? '';
foreach ($this->suggestVariablesAtNode($node, $namePrefix) as $var) {
@ -175,23 +188,28 @@ class CompletionProvider
);
$list->items[] = $item;
}
} /*
MEMBER ACCESS EXPRESSIONS
$a->c#
$a-># */
elseif ($node instanceof Node\Expression\MemberAccessExpression) {
} elseif ($node instanceof Node\Expression\MemberAccessExpression) {
// Member access expressions
//
// $a->c|
// $a->|
// Multiple prefixes for all possible types
$prefixes = FqnUtilities\getFqnsFromType(
$this->definitionResolver->resolveExpressionNodeToType($node->dereferencableExpression)
);
// Include parent classes
$prefixes = $this->expandParentFqns($prefixes);
// Add the object access operator to only get members
foreach ($prefixes as &$prefix) {
$prefix .= '->';
}
unset($prefix);
// Collect all definitions that match any of the prefixes
foreach ($this->index->getDefinitions() as $fqn => $def) {
foreach ($prefixes as $prefix) {
if (substr($fqn, 0, strlen($prefix)) === $prefix && !$def->isGlobal) {
@ -199,30 +217,35 @@ class CompletionProvider
}
}
}
} /*
SCOPED PROPERTY ACCESS EXPRESSIONS
A\B\C::$a#
A\B\C::#
A\B\C::$#
A\B\C::foo#
TODO: $a::# */
elseif (
} elseif (
($scoped = $node->parent) instanceof Node\Expression\ScopedPropertyAccessExpression ||
($scoped = $node) instanceof Node\Expression\ScopedPropertyAccessExpression
) {
// Static class members and constants
//
// A\B\C::$a|
// A\B\C::|
// A\B\C::$|
// A\B\C::foo|
//
// TODO: $a::|
// Resolve all possible types to FQNs
$prefixes = FqnUtilities\getFqnsFromType(
$classType = $this->definitionResolver->resolveExpressionNodeToType($scoped->scopeResolutionQualifier)
);
// Add parent classes
$prefixes = $this->expandParentFqns($prefixes);
// Append :: operator to only get static members
foreach ($prefixes as &$prefix) {
$prefix .= '::';
}
unset($prefix);
// Collect all definitions that match any of the prefixes
foreach ($this->index->getDefinitions() as $fqn => $def) {
foreach ($prefixes as $prefix) {
if (substr(strtolower($fqn), 0, strlen($prefix)) === strtolower($prefix) && !$def->isGlobal) {
@ -230,82 +253,123 @@ class CompletionProvider
}
}
}
} elseif (ParserHelpers\isConstantFetch($node) ||
($creation = $node->parent) instanceof Node\Expression\ObjectCreationExpression ||
(($creation = $node) instanceof Node\Expression\ObjectCreationExpression)) {
$class = isset($creation) ? $creation->classTypeDesignator : $node;
$prefix = $class instanceof Node\QualifiedName
? (string)PhpParser\ResolvedName::buildName($class->nameParts, $class->getFileContents())
: $class->getText($node->getFileContents());
} elseif (
ParserHelpers\isConstantFetch($node)
// Creation gets set in case of an instantiation (`new` expression)
|| ($creation = $node->parent) instanceof Node\Expression\ObjectCreationExpression
|| (($creation = $node) instanceof Node\Expression\ObjectCreationExpression)
) {
// Class instantiations, function calls, constant fetches, class names
//
// new MyCl|
// my_func|
// MY_CONS|
// MyCla|
$namespaceDefinition = $node->getNamespaceDefinition();
// The name Node under the cursor
$nameNode = isset($creation) ? $creation->classTypeDesignator : $node;
list($namespaceImportTable,,) = $node->getImportTablesForCurrentScope();
foreach ($namespaceImportTable as $alias => $name) {
$namespaceImportTable[$alias] = (string)$name;
/** The typed name */
$prefix = $nameNode instanceof Node\QualifiedName
? (string)PhpParser\ResolvedName::buildName($nameNode->nameParts, $nameNode->getFileContents())
: $nameNode->getText($node->getFileContents());
$prefixLen = strlen($prefix);
/** Whether the prefix is qualified (contains at least one backslash) */
$isQualified = $nameNode instanceof Node\QualifiedName && $nameNode->isQualifiedName();
/** Whether the prefix is fully qualified (begins with a backslash) */
$isFullyQualified = $nameNode instanceof Node\QualifiedName && $nameNode->isFullyQualifiedName();
/** The closest NamespaceDefinition Node */
$namespaceNode = $node->getNamespaceDefinition();
/** @var string The name of the namespace */
$namespacedPrefix = null;
if ($namespaceNode) {
$namespacedPrefix = (string)PhpParser\ResolvedName::buildName($namespaceNode->name->nameParts, $node->getFileContents()) . '\\' . $prefix;
$namespacedPrefixLen = strlen($namespacedPrefix);
}
// Get the namespace use statements
// TODO: use function statements, use const statements
/** @var string[] $aliases A map from local alias to fully qualified name */
list($aliases,,) = $node->getImportTablesForCurrentScope();
foreach ($aliases as $alias => $name) {
$aliases[$alias] = (string)$name;
}
// If there is a prefix that does not start with a slash, suggest `use`d symbols
if ($prefix && !$isFullyQualified) {
foreach ($aliases as $alias => $fqn) {
// Suggest symbols that have been `use`d and match the prefix
if (substr($alias, 0, $prefixLen) === $prefix && ($def = $this->index->getDefinition($fqn))) {
$list->items[] = CompletionItem::fromDefinition($def);
}
}
}
// Suggest global symbols that either
// - start with the current namespace + prefix, if the Name node is not fully qualified
// - start with just the prefix, if the Name node is fully qualified
foreach ($this->index->getDefinitions() as $fqn => $def) {
$fqnStartsWithPrefix = substr($fqn, 0, strlen($prefix)) === $prefix;
$fqnContainsPrefix = empty($prefix) || strpos($fqn, $prefix) !== false;
if (($def->canBeInstantiated || ($def->isGlobal && !isset($creation))) && $fqnContainsPrefix) {
if ($namespaceDefinition !== null && $namespaceDefinition->name !== null) {
$namespacePrefix = (string)PhpParser\ResolvedName::buildName($namespaceDefinition->name->nameParts, $node->getFileContents());
$isAliased = false;
$isNotFullyQualified = !($class instanceof Node\QualifiedName) || !$class->isFullyQualifiedName();
if ($isNotFullyQualified) {
foreach ($namespaceImportTable as $alias => $name) {
if (substr($fqn, 0, strlen($name)) === $name) {
$fqn = $alias;
$isAliased = true;
break;
}
}
}
$prefixWithNamespace = $namespacePrefix . "\\" . $prefix;
$fqnMatchesPrefixWithNamespace = substr($fqn, 0, strlen($prefixWithNamespace)) === $prefixWithNamespace;
$isFullyQualifiedAndPrefixMatches = !$isNotFullyQualified && ($fqnStartsWithPrefix || $fqnMatchesPrefixWithNamespace);
if (!$isFullyQualifiedAndPrefixMatches && !$isAliased) {
if (!array_search($fqn, array_values($namespaceImportTable))) {
if (empty($prefix)) {
$fqn = '\\' . $fqn;
} elseif ($fqnMatchesPrefixWithNamespace) {
$fqn = substr($fqn, strlen($namespacePrefix) + 1);
} else {
continue;
}
} else {
continue;
}
}
} elseif ($fqnStartsWithPrefix && $class instanceof Node\QualifiedName && $class->isFullyQualifiedName()) {
$fqn = '\\' . $fqn;
}
$fqnStartsWithPrefix = substr($fqn, 0, $prefixLen) === $prefix;
if (
// Exclude methods, properties etc.
$def->isGlobal
&& (
!$prefix
|| (
// Either not qualified, but a matching prefix with global fallback
($def->roamed && !$isQualified && $fqnStartsWithPrefix)
// Or not in a namespace or a fully qualified name or AND matching the prefix
|| ((!$namespaceNode || $isFullyQualified) && $fqnStartsWithPrefix)
// Or in a namespace, not fully qualified and matching the prefix + current namespace
|| (
$namespaceNode
&& !$isFullyQualified
&& substr($fqn, 0, $namespacedPrefixLen) === $namespacedPrefix
)
)
)
// Only suggest classes for `new`
&& (!isset($creation) || $def->canBeInstantiated)
) {
$item = CompletionItem::fromDefinition($def);
// Find the shortest name to reference the symbol
if ($namespaceNode && ($alias = array_search($fqn, $aliases, true)) !== false) {
// $alias is the name under which this definition is aliased in the current namespace
$item->insertText = $alias;
} else if ($namespaceNode && !($prefix && $isFullyQualified)) {
// Insert the global FQN with leading backslash
$item->insertText = '\\' . $fqn;
} else {
// Insert the FQN without leading backlash
$item->insertText = $fqn;
}
// Don't insert the parenthesis for functions
// TODO return a snippet and put the cursor inside
if (substr($item->insertText, -2) === '()') {
$item->insertText = substr($item->insertText, 0, -2);
}
$list->items[] = $item;
}
}
// If not a class instantiation, also suggest keywords
if (!isset($creation)) {
foreach (self::KEYWORDS as $keyword) {
if (substr($keyword, 0, $prefixLen) === $prefix) {
$item = new CompletionItem($keyword, CompletionItemKind::KEYWORD);
$item->insertText = $keyword . ' ';
$item->insertText = $keyword;
$list->items[] = $item;
}
}
} elseif (ParserHelpers\isConstantFetch($node)) {
$prefix = (string) ($node->getResolvedName() ?? PhpParser\ResolvedName::buildName($node->nameParts, $node->getFileContents()));
foreach (self::KEYWORDS as $keyword) {
$item = new CompletionItem($keyword, CompletionItemKind::KEYWORD);
$item->insertText = $keyword . ' ';
$list->items[] = $item;
}
}

View File

@ -44,6 +44,13 @@ class Definition
*/
public $isGlobal;
/**
* True if this definition is affected by global namespace fallback (global function or global constant)
*
* @var bool
*/
public $roamed;
/**
* False for instance methods and properties
*

View File

@ -54,7 +54,7 @@ class DefinitionResolver
{
// If node is part of a declaration list, build a declaration line that discludes other elements in the list
// - [PropertyDeclaration] // public $a, [$b = 3], $c; => public $b = 3;
// - [ConstDeclaration | ClassConstDeclaration] // "const A = 3, [B = 4];" => "const B = 4;"
// - [ConstDeclaration|ClassConstDeclaration] // "const A = 3, [B = 4];" => "const B = 4;"
if (
($declaration = ParserHelpers\tryGetPropertyDeclaration($node)) && ($elements = $declaration->propertyElements) ||
($declaration = ParserHelpers\tryGetConstOrClassConstDeclaration($node)) && ($elements = $declaration->constElements)
@ -131,7 +131,7 @@ class DefinitionResolver
* Gets Doc Block with resolved names for a Node
*
* @param Node $node
* @return DocBlock | null
* @return DocBlock|null
*/
private function getDocBlock(Node $node)
{
@ -193,6 +193,16 @@ class DefinitionResolver
($node instanceof Node\ConstElement && $node->parent->parent instanceof Node\Statement\ConstDeclaration)
);
// Definition is affected by global namespace fallback if it is a global constant or a global function
$def->roamed = (
$fqn !== null
&& strpos($fqn, '\\') === false
&& (
($node instanceof Node\ConstElement && $node->parent->parent instanceof Node\Statement\ConstDeclaration)
|| $node instanceof Node\Statement\FunctionDeclaration
)
);
// Static methods and static property declarations
$def->isStatic = (
($node instanceof Node\MethodDeclaration && $node->isStatic()) ||
@ -482,8 +492,8 @@ class DefinitionResolver
/**
* Returns the assignment or parameter node where a variable was defined
*
* @param Node\Expression\Variable | Node\Expression\ClosureUse $var The variable access
* @return Node\Expression\Assign | Node\Expression\AssignOp|Node\Param | Node\Expression\ClosureUse|null
* @param Node\Expression\Variable|Node\Expression\ClosureUse $var The variable access
* @return Node\Expression\Assign|Node\Expression\AssignOp|Node\Param|Node\Expression\ClosureUse|null
*/
public function resolveVariableToNode($var)
{
@ -633,6 +643,16 @@ class DefinitionResolver
}
}
// MEMBER CALL EXPRESSION/SCOPED PROPERTY CALL EXPRESSION
// The type of the member/scoped property call expression is the type of the method, so resolve the
// type of the callable expression.
if ($expr instanceof Node\Expression\CallExpression && (
$expr->callableExpression instanceof Node\Expression\MemberAccessExpression ||
$expr->callableExpression instanceof Node\Expression\ScopedPropertyAccessExpression)
) {
return $this->resolveExpressionNodeToType($expr->callableExpression);
}
// MEMBER ACCESS EXPRESSION
if ($expr instanceof Node\Expression\MemberAccessExpression) {
if ($expr->memberName instanceof Node\Expression) {
@ -894,7 +914,7 @@ class DefinitionResolver
* Takes any class name node (from a static method call, or new node) and returns a Type object
* Resolves keywords like self, static and parent
*
* @param Node | PhpParser\Token $class
* @param Node|PhpParser\Token $class
* @return Type
*/
public function resolveClassNameToType($class): Type
@ -906,11 +926,12 @@ class DefinitionResolver
// Anonymous class
return new Types\Object_;
}
$className = (string)$class->getResolvedName();
if ($className === 'static') {
if ($class instanceof PhpParser\Token && $class->kind === PhpParser\TokenKind::StaticKeyword) {
// `new static`
return new Types\Static_;
}
$className = (string)$class->getResolvedName();
if ($className === 'self' || $className === 'parent') {
$classNode = $class->getFirstAncestor(Node\Statement\ClassDeclaration::class);
if ($className === 'parent') {
@ -1190,9 +1211,9 @@ class DefinitionResolver
}
/**
* @param DocBlock | null $docBlock
* @param string | null $variableName
* @return DocBlock\Tags\Param | null
* @param DocBlock|null $docBlock
* @param string|null $variableName
* @return DocBlock\Tags\Param|null
*/
private function tryGetDocBlockTagForParameter($docBlock, $variableName)
{

View File

@ -22,7 +22,11 @@ class FileSystemFilesFinder implements FilesFinder
return coroutine(function () use ($glob) {
$uris = [];
foreach (new GlobIterator($glob) as $path) {
// Exclude any directories that also match the glob pattern
if (!is_dir($path)) {
$uris[] = pathToUri($path);
}
yield timeout();
}
return $uris;

View File

@ -77,7 +77,7 @@ function isBooleanExpression($expression) : bool
/**
* Tries to get the parent property declaration given a Node
* @param Node $node
* @return Node\PropertyDeclaration | null $node
* @return Node\PropertyDeclaration|null $node
*/
function tryGetPropertyDeclaration(Node $node)
{
@ -93,7 +93,7 @@ function tryGetPropertyDeclaration(Node $node)
/**
* Tries to get the parent ConstDeclaration or ClassConstDeclaration given a Node
* @param Node $node
* @return Node\Statement\ConstDeclaration | Node\ClassConstDeclaration | null $node
* @return Node\Statement\ConstDeclaration|Node\ClassConstDeclaration|null $node
*/
function tryGetConstOrClassConstDeclaration(Node $node)
{

View File

@ -46,19 +46,12 @@ class PhpDocument
*/
private $uri;
/**
* The content of the document
*
* @var string
*/
private $content;
/**
* The AST of the document
*
* @var Node
* @var Node\SourceFileNode
*/
private $stmts;
private $sourceFileNode;
/**
* Map from fully qualified name (FQN) to Definition
@ -133,8 +126,6 @@ class PhpDocument
*/
public function updateContent(string $content)
{
$this->content = $content;
// Unregister old definitions
if (isset($this->definitions)) {
foreach ($this->definitions as $fqn => $definition) {
@ -172,7 +163,7 @@ class PhpDocument
$this->index->addReferenceUri($fqn, $this->uri);
}
$this->stmts = $treeAnalyzer->getStmts();
$this->sourceFileNode = $treeAnalyzer->getSourceFileNode();
}
/**
@ -182,10 +173,10 @@ class PhpDocument
*/
public function getFormattedText()
{
if (empty($this->content)) {
if (empty($this->getContent())) {
return [];
}
return Formatter::format($this->content, $this->uri);
return Formatter::format($this->getContent(), $this->uri);
}
/**
@ -195,7 +186,7 @@ class PhpDocument
*/
public function getContent()
{
return $this->content;
return $this->sourceFileNode->fileContents;
}
/**
@ -221,11 +212,11 @@ class PhpDocument
/**
* Returns the AST of the document
*
* @return Node | null
* @return Node\SourceFileNode|null
*/
public function getStmts()
public function getSourceFileNode()
{
return $this->stmts;
return $this->sourceFileNode;
}
/**
@ -236,12 +227,12 @@ class PhpDocument
*/
public function getNodeAtPosition(Position $position)
{
if ($this->stmts === null) {
if ($this->sourceFileNode === null) {
return null;
}
$offset = $position->toOffset($this->stmts->getFileContents());
$node = $this->stmts->getDescendantNodeAtPosition($offset);
$offset = $position->toOffset($this->sourceFileNode->getFileContents());
$node = $this->sourceFileNode->getDescendantNodeAtPosition($offset);
if ($node !== null && $node->getStart() > $offset) {
return null;
}
@ -256,12 +247,10 @@ class PhpDocument
*/
public function getRange(Range $range)
{
if ($this->content === null) {
return null;
}
$start = $range->start->toOffset($this->content);
$length = $range->end->toOffset($this->content) - $start;
return substr($this->content, $start, $length);
$content = $this->getContent();
$start = $range->start->toOffset($content);
$length = $range->end->toOffset($content) - $start;
return substr($content, $start, $length);
}
/**

View File

@ -15,8 +15,8 @@ class TreeAnalyzer
/** @var PhpParser\Parser */
private $parser;
/** @var Node */
private $stmts;
/** @var Node\SourceFileNode */
private $sourceFileNode;
/** @var Diagnostic[] */
private $diagnostics;
@ -45,18 +45,17 @@ class TreeAnalyzer
$this->parser = $parser;
$this->docBlockFactory = $docBlockFactory;
$this->definitionResolver = $definitionResolver;
$this->content = $content;
$this->stmts = $this->parser->parseSourceFile($content, $uri);
$this->sourceFileNode = $this->parser->parseSourceFile($content, $uri);
// TODO - docblock errors
$this->collectDefinitionsAndReferences($this->stmts);
$this->collectDefinitionsAndReferences($this->sourceFileNode);
}
private function collectDefinitionsAndReferences(Node $stmts)
private function collectDefinitionsAndReferences(Node $sourceFileNode)
{
foreach ($stmts::CHILD_NAMES as $name) {
$node = $stmts->$name;
foreach ($sourceFileNode::CHILD_NAMES as $name) {
$node = $sourceFileNode->$name;
if ($node === null) {
continue;
@ -76,7 +75,7 @@ class TreeAnalyzer
}
if (($error = PhpParser\DiagnosticsProvider::checkDiagnostics($node)) !== null) {
$range = PhpParser\PositionUtilities::getRangeFromPosition($error->start, $error->length, $this->content);
$range = PhpParser\PositionUtilities::getRangeFromPosition($error->start, $error->length, $this->sourceFileNode->fileContents);
$this->diagnostics[] = new Diagnostic(
$error->message,
@ -200,10 +199,10 @@ class TreeAnalyzer
}
/**
* @return Node[]
* @return Node\SourceFileNode
*/
public function getStmts()
public function getSourceFileNode()
{
return $this->stmts;
return $this->sourceFileNode;
}
}

View File

@ -14,11 +14,11 @@ class DefinitionResolverTest extends TestCase
{
$parser = new PhpParser\Parser;
$doc = new MockPhpDocument;
$stmts = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$sourceFileNode = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$def = $definitionResolver->createDefinitionFromNode($stmts->statementList[1]->expression, '\TEST_DEFINE');
$def = $definitionResolver->createDefinitionFromNode($sourceFileNode->statementList[1]->expression, '\TEST_DEFINE');
$this->assertInstanceOf(\phpDocumentor\Reflection\Types\Boolean::class, $def->type);
}
@ -27,11 +27,11 @@ class DefinitionResolverTest extends TestCase
{
$parser = new PhpParser\Parser;
$doc = new MockPhpDocument;
$stmts = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$sourceFileNode = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$type = $definitionResolver->getTypeFromNode($stmts->statementList[1]->expression);
$type = $definitionResolver->getTypeFromNode($sourceFileNode->statementList[1]->expression);
$this->assertInstanceOf(\phpDocumentor\Reflection\Types\Boolean::class, $type);
}
@ -41,11 +41,11 @@ class DefinitionResolverTest extends TestCase
// define('XXX') (only one argument) must not introduce a new symbol
$parser = new PhpParser\Parser;
$doc = new MockPhpDocument;
$stmts = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE');", $doc->getUri());
$sourceFileNode = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE');", $doc->getUri());
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$fqn = $definitionResolver->getDefinedFqn($stmts->statementList[1]->expression);
$fqn = $definitionResolver->getDefinedFqn($sourceFileNode->statementList[1]->expression);
$this->assertNull($fqn);
}
@ -54,11 +54,11 @@ class DefinitionResolverTest extends TestCase
{
$parser = new PhpParser\Parser;
$doc = new MockPhpDocument;
$stmts = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$sourceFileNode = $parser->parseSourceFile("<?php\ndefine('TEST_DEFINE', true);", $doc->getUri());
$index = new Index;
$definitionResolver = new DefinitionResolver($index);
$fqn = $definitionResolver->getDefinedFqn($stmts->statementList[1]->expression);
$fqn = $definitionResolver->getDefinedFqn($sourceFileNode->statementList[1]->expression);
$this->assertEquals('TEST_DEFINE', $fqn);
}

View File

@ -57,7 +57,7 @@ class LanguageServerTest extends TestCase
if ($msg->body->method === 'window/logMessage' && $promise->state === Promise::PENDING) {
if ($msg->body->params->type === MessageType::ERROR) {
$promise->reject(new Exception($msg->body->params->message));
} else if (strpos($msg->body->params->message, 'All 27 PHP files parsed') !== false) {
} else if (preg_match('/All \d+ PHP files parsed/', $msg->body->params->message)) {
$promise->fulfill();
}
}
@ -103,7 +103,7 @@ class LanguageServerTest extends TestCase
if ($promise->state === Promise::PENDING) {
$promise->reject(new Exception($msg->body->params->message));
}
} else if (strpos($msg->body->params->message, 'All 27 PHP files parsed') !== false) {
} else if (preg_match('/All \d+ PHP files parsed/', $msg->body->params->message)) {
$promise->fulfill();
}
}

View File

@ -85,6 +85,9 @@ abstract class ServerTestCase extends TestCase
'TestClass::staticTestMethod()' => new Location($globalSymbolsUri, new Range(new Position(46, 4), new Position(49, 5))),
'TestClass::testMethod()' => new Location($globalSymbolsUri, new Range(new Position(57, 4), new Position(60, 5))),
'test_function()' => new Location($globalSymbolsUri, new Range(new Position(78, 0), new Position(81, 1))),
'UnusedClass' => new Location($globalSymbolsUri, new Range(new Position(111, 0), new Position(118, 1))),
'UnusedClass::unusedProperty' => new Location($globalSymbolsUri, new Range(new Position(113,11), new Position(113, 26))),
'UnusedClass::unusedMethod' => new Location($globalSymbolsUri, new Range(new Position(115, 4), new Position(117, 5))),
'whatever()' => new Location($globalReferencesUri, new Range(new Position(21, 0), new Position(23, 1))),
// Namespaced

View File

@ -69,6 +69,27 @@ class CompletionTest extends TestCase
], true), $items);
}
public function testGlobalFunctionInsideNamespaceAndClass()
{
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/completion/inside_namespace_and_method.php');
$this->loader->open($completionUri, file_get_contents($completionUri));
$items = $this->textDocument->completion(
new TextDocumentIdentifier($completionUri),
new Position(8, 11)
)->wait();
$this->assertCompletionsListSubset(new CompletionList([
new CompletionItem(
'test_function',
CompletionItemKind::FUNCTION,
'void', // Return type
'Officia aliquip adipisicing et nulla et laboris dolore labore.',
null,
null,
'\test_function'
)
], true), $items);
}
public function testPropertyAndMethodWithoutPrefix()
{
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/completion/property.php');
@ -234,10 +255,7 @@ class CompletionTest extends TestCase
'laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam' . "\n" .
'veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat' . "\n" .
'consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem' . "\n" .
'sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.',
null,
null,
'TestClass'
'sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.'
)
], true), $items);
}
@ -397,8 +415,8 @@ class CompletionTest extends TestCase
new Position(2, 1)
)->wait();
$this->assertCompletionsListSubset(new CompletionList([
new CompletionItem('class', CompletionItemKind::KEYWORD, null, null, null, null, 'class '),
new CompletionItem('clone', CompletionItemKind::KEYWORD, null, null, null, null, 'clone ')
new CompletionItem('class', CompletionItemKind::KEYWORD, null, null, null, null, 'class'),
new CompletionItem('clone', CompletionItemKind::KEYWORD, null, null, null, null, 'clone')
], true), $items);
}
@ -499,6 +517,50 @@ class CompletionTest extends TestCase
], true), $items);
}
public function testMethodReturnType()
{
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/completion/method_return_type.php');
$this->loader->open($completionUri, file_get_contents($completionUri));
$items = $this->textDocument->completion(
new TextDocumentIdentifier($completionUri),
new Position(10, 6)
)->wait();
$this->assertCompletionsListSubset(new CompletionList([
new CompletionItem(
'foo',
CompletionItemKind::METHOD,
'\FooClass',
null,
null,
null,
null,
null
)
], true), $items);
}
public function testStaticMethodReturnType()
{
$completionUri = pathToUri(__DIR__ . '/../../../fixtures/completion/static_method_return_type.php');
$this->loader->open($completionUri, file_get_contents($completionUri));
$items = $this->textDocument->completion(
new TextDocumentIdentifier($completionUri),
new Position(11, 6)
)->wait();
$this->assertCompletionsListSubset(new CompletionList([
new CompletionItem(
'bar',
CompletionItemKind::METHOD,
'mixed',
null,
null,
null,
null,
null
)
], true), $items);
}
private function assertCompletionsListSubset(CompletionList $subsetList, CompletionList $list)
{
foreach ($subsetList->items as $expectedItem) {

View File

@ -159,4 +159,43 @@ class GlobalTest extends ServerTestCase
)->wait();
$this->assertEquals($this->getReferenceLocations('TestClass'), $result);
}
public function testReferencesForUnusedClass()
{
// class UnusedClass
// Get references for UnusedClass
$symbolsUri = pathToUri(realpath(__DIR__ . '/../../../../fixtures/global_symbols.php'));
$result = $this->textDocument->references(
new ReferenceContext,
new TextDocumentIdentifier($symbolsUri),
new Position(111, 10)
)->wait();
$this->assertEquals([], $result);
}
public function testReferencesForUnusedProperty()
{
// public $unusedProperty
// Get references for unusedProperty
$symbolsUri = pathToUri(realpath(__DIR__ . '/../../../../fixtures/global_symbols.php'));
$result = $this->textDocument->references(
new ReferenceContext,
new TextDocumentIdentifier($symbolsUri),
new Position(113, 18)
)->wait();
$this->assertEquals([], $result);
}
public function testReferencesForUnusedMethod()
{
// public function unusedMethod()
// Get references for unusedMethod
$symbolsUri = pathToUri(realpath(__DIR__ . '/../../../../fixtures/global_symbols.php'));
$result = $this->textDocument->references(
new ReferenceContext,
new TextDocumentIdentifier($symbolsUri),
new Position(115, 26)
)->wait();
$this->assertEquals([], $result);
}
}

View File

@ -27,6 +27,7 @@ class SymbolTest extends ServerTestCase
// Request symbols
$result = $this->workspace->symbol('')->wait();
$referencesUri = pathToUri(realpath(__DIR__ . '/../../../fixtures/references.php'));
// @codingStandardsIgnoreStart
$this->assertEquals([
new SymbolInformation('TestNamespace', SymbolKind::NAMESPACE, new Location($referencesUri, new Range(new Position(2, 0), new Position(2, 24))), ''),
@ -59,9 +60,12 @@ class SymbolTest extends ServerTestCase
new SymbolInformation('test_function', SymbolKind::FUNCTION, $this->getDefinitionLocation('test_function()'), ''),
new SymbolInformation('ChildClass', SymbolKind::CLASS_, $this->getDefinitionLocation('ChildClass'), ''),
new SymbolInformation('TEST_DEFINE_CONSTANT', SymbolKind::CONSTANT, $this->getDefinitionLocation('TEST_DEFINE_CONSTANT'), ''),
new SymbolInformation('UnusedClass', SymbolKind::CLASS_, $this->getDefinitionLocation('UnusedClass'), ''),
new SymbolInformation('unusedProperty', SymbolKind::PROPERTY, $this->getDefinitionLocation('UnusedClass::unusedProperty'), 'UnusedClass'),
new SymbolInformation('unusedMethod', SymbolKind::METHOD, $this->getDefinitionLocation('UnusedClass::unusedMethod'), 'UnusedClass'),
new SymbolInformation('whatever', SymbolKind::FUNCTION, $this->getDefinitionLocation('whatever()'), ''),
new SymbolInformation('SecondTestNamespace', SymbolKind::NAMESPACE, $this->getDefinitionLocation('SecondTestNamespace'), '')
new SymbolInformation('SecondTestNamespace', SymbolKind::NAMESPACE, $this->getDefinitionLocation('SecondTestNamespace'), ''),
], $result);
// @codingStandardsIgnoreEnd
}

View File

@ -64,12 +64,7 @@ class ValidationTest extends TestCase
try {
$this->assertEquals($expectedValues['definitions'], $actualValues['definitions']);
try {
$this->assertArraySubset((array)$expectedValues['references'], (array)$actualValues['references'], false, 'references don\'t match.');
} catch (\Throwable $e) {
$this->assertEquals((array)$expectedValues['references'], (array)$actualValues['references'], 'references don\'t match.');
}
} catch (\Throwable $e) {
$outputFile = getExpectedValuesFile($testCaseFile);
file_put_contents($outputFile, json_encode($actualValues, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));
@ -137,8 +132,7 @@ class ValidationTest extends TestCase
} elseif ($propertyName === 'extends') {
$definition->$propertyName = $definition->$propertyName ?? [];
} elseif ($propertyName === 'type' && $definition->type !== null) {
// Class info is not captured by json_encode. It's important for 'type'.
$defsForAssert[$fqn]['type__class'] = get_class($definition->type);
$defsForAssert[$fqn]['type__tostring'] = (string)$definition->type;
}
$defsForAssert[$fqn][$propertyName] = $definition->$propertyName;

View File

@ -6,6 +6,12 @@
"self": [
"./WithReturnTypehints.php"
],
"Fixtures\\Prophecy\\__CLASS__": [
"./WithReturnTypehints.php"
],
"__CLASS__": [
"./WithReturnTypehints.php"
],
"parent": [
"./WithReturnTypehints.php"
]
@ -15,6 +21,7 @@
"fqn": "Fixtures\\Prophecy",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -35,6 +42,7 @@
"Fixtures\\Prophecy\\EmptyClass"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -53,6 +61,7 @@
"fqn": "Fixtures\\Prophecy\\WithReturnTypehints->getSelf()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -63,7 +72,7 @@
},
"containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type__tostring": "\\self",
"type": {},
"declarationLine": "public function getSelf(): self {",
"documentation": null
@ -72,6 +81,7 @@
"fqn": "Fixtures\\Prophecy\\WithReturnTypehints->getName()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -82,7 +92,7 @@
},
"containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
},
"type__class": "phpDocumentor\\Reflection\\Types\\String_",
"type__tostring": "string",
"type": {},
"declarationLine": "public function getName(): string {",
"documentation": null
@ -91,6 +101,7 @@
"fqn": "Fixtures\\Prophecy\\WithReturnTypehints->getParent()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -101,7 +112,7 @@
},
"containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type__tostring": "\\parent",
"type": {},
"declarationLine": "public function getParent(): parent {",
"documentation": null

View File

@ -5,6 +5,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -5,6 +5,7 @@
"fqn": "A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -23,6 +24,7 @@
"fqn": "A->foo",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,7 +35,7 @@
},
"containerName": "A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Array_",
"type__tostring": "string[]",
"type": {},
"declarationLine": "protected $foo;",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -12,6 +12,7 @@
"fqn": "TestNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "TestNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "TestNamespace\\A->a",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "TestNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Integer",
"type__tostring": "int",
"type": {},
"declarationLine": "public $a;",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "TestNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "TestNamespace\\TestClass",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "TestNamespace\\TestClass->testProperty",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "TestNamespace\\TestClass"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public $testProperty;",
"documentation": null
@ -67,6 +70,7 @@
"fqn": "TestNamespace\\TestClass->testMethod()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -77,7 +81,7 @@
},
"containerName": "TestNamespace\\TestClass"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function testMethod($testParameter)",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "MyNamespace\\A::suite()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public static function suite()",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "MyNamespace\\A::suite()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public static function suite()",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "MyNamespace\\A::suite()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public static function suite()",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "MyNamespace\\A->suite()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function suite()",
"documentation": null

View File

@ -9,6 +9,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -27,6 +28,7 @@
"fqn": "MyNamespace\\Mbstring",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -45,6 +47,7 @@
"fqn": "MyNamespace\\Mbstring::MB_CASE_FOLD",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -55,7 +58,7 @@
},
"containerName": "MyNamespace\\Mbstring"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type__tostring": "\\MyNamespace\\PHP_INT_MAX",
"type": {},
"declarationLine": "const MB_CASE_FOLD = PHP_INT_MAX;",
"documentation": null

View File

@ -9,6 +9,7 @@
"fqn": "A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -27,6 +28,7 @@
"fqn": "A->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -37,7 +39,7 @@
},
"containerName": "A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b ($a = MY_CONSTANT);",
"documentation": null

View File

@ -5,6 +5,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -1,10 +1,15 @@
{
"references": [],
"references": {
"MyNamespace\\Exception": [
"./exceptions1.php"
]
},
"definitions": {
"MyNamespace": {
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -3,6 +3,9 @@
"LanguageServer": [
"./functionUse2.php"
],
"LanguageServer\\pathToUri()": [
"./functionUse2.php"
],
"LanguageServer\\timeout()": [
"./functionUse2.php"
]

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -5,6 +5,7 @@
"fqn": "A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -1,10 +1,18 @@
{
"references": [],
"references": {
"B\\__FILE__": [
"./magicConstantsShouldBeGlobal.php"
],
"__FILE__": [
"./magicConstantsShouldBeGlobal.php"
]
},
"definitions": {
"B": {
"fqn": "B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -1,10 +1,15 @@
{
"references": [],
"references": {
"__CLASS__": [
"./magicConsts.php"
]
},
"definitions": {
"A": {
"fqn": "A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -23,6 +28,7 @@
"fqn": "A::$deprecationsTriggered",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,7 +39,7 @@
},
"containerName": "A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Array_",
"type__tostring": "\\__CLASS__[]",
"type": {},
"declarationLine": "private static $deprecationsTriggered;",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "MyNamespace\\A::a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "static function a() {",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "MyNamespace\\A::a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "static function a() {",
"documentation": null

View File

@ -27,6 +27,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -45,6 +46,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -63,6 +65,7 @@
"fqn": "MyNamespace\\A::getInitializer()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -73,7 +76,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public static function getInitializer(ClassLoader $loader)",
"documentation": null

View File

@ -18,6 +18,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -36,6 +37,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -54,6 +56,7 @@
"fqn": "MyNamespace\\A->testRequest()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -64,7 +67,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function testRequest()",
"documentation": null

View File

@ -1,10 +1,15 @@
{
"references": [],
"references": {
"MyNamespace\\ParseErrorsTest->args": [
"./memberAccess5.php"
]
},
"definitions": {
"MyNamespace": {
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -23,6 +28,7 @@
"fqn": "MyNamespace\\ParseErrorsTest",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -41,6 +47,7 @@
"fqn": "MyNamespace\\ParseErrorsTest->setUp()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -51,7 +58,7 @@
},
"containerName": "MyNamespace\\ParseErrorsTest"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function setUp()",
"documentation": null

View File

@ -15,6 +15,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,6 +34,7 @@
"fqn": "MyNamespace\\ParseErrorsTest",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -51,6 +53,7 @@
"fqn": "MyNamespace\\ParseErrorsTest->setAccount()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -61,7 +64,7 @@
},
"containerName": "MyNamespace\\ParseErrorsTest"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function setAccount(AccountInterface $account)",
"documentation": null

View File

@ -0,0 +1,7 @@
<?php
class FooClass {
public function foo(): FooClass {
return $this;
}
}

View File

@ -0,0 +1,48 @@
{
"references": {
"FooClass": [
"./methodReturnType.php"
]
},
"definitions": {
"FooClass": {
"fqn": "FooClass",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
"name": "FooClass",
"kind": 5,
"location": {
"uri": "./methodReturnType.php"
},
"containerName": ""
},
"type": null,
"declarationLine": "class FooClass {",
"documentation": null
},
"FooClass->foo()": {
"fqn": "FooClass->foo()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
"name": "foo",
"kind": 6,
"location": {
"uri": "./methodReturnType.php"
},
"containerName": "FooClass"
},
"type__tostring": "\\FooClass",
"type": {},
"declarationLine": "public function foo(): FooClass {",
"documentation": null
}
}
}

View File

@ -18,6 +18,7 @@
"fqn": "MyNamespace1",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -36,6 +37,7 @@
"fqn": "MyNamespace1\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -54,6 +56,7 @@
"fqn": "MyNamespace1\\B->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -64,7 +67,7 @@
},
"containerName": "MyNamespace1\\B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -73,6 +76,7 @@
"fqn": "MyNamespace2",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -93,6 +97,7 @@
"MyNamespace2\\MyNamespace1\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -111,6 +116,7 @@
"fqn": "MyNamespace2\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -121,7 +127,7 @@
},
"containerName": "MyNamespace2\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -5,6 +5,7 @@
"fqn": "Foo",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -23,6 +24,7 @@
"fqn": "Foo->fn()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,7 +35,7 @@
},
"containerName": "Foo"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type__tostring": "\\Iterator",
"type": {},
"declarationLine": "public function fn()",
"documentation": "Foo"

View File

@ -5,6 +5,7 @@
"fqn": "A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -23,6 +24,7 @@
"fqn": "A->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,7 +35,7 @@
},
"containerName": "A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null

View File

@ -18,6 +18,7 @@
"fqn": "MyNamespace1",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -27,6 +27,7 @@
"fqn": "B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -5,6 +5,7 @@
"fqn": "A\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -2,6 +2,12 @@
"references": {
"LanguageServer": [
"./namespaces8.php"
],
"LanguageServer\\pathToUri()": [
"./namespaces8.php"
],
"LanguageServer\\uriToPath()": [
"./namespaces8.php"
]
},
"definitions": {
@ -9,6 +15,7 @@
"fqn": "LanguageServer\\Tests\\Utils",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -9,6 +9,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -27,6 +28,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -45,6 +47,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -55,7 +58,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "MyNamespace\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -66,6 +69,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -76,7 +80,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -9,6 +9,7 @@
"fqn": "A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -27,6 +28,7 @@
"fqn": "A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -37,7 +39,7 @@
},
"containerName": "A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -9,6 +9,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -27,6 +28,7 @@
"fqn": "MyNamespace\\init()",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -37,7 +39,7 @@
},
"containerName": "MyNamespace"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function init(Hi $view)",
"documentation": null

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "MyNamespace\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "MyNamespace\\B->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "MyNamespace\\B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -69,6 +72,7 @@
"MyNamespace\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -87,6 +91,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -97,7 +102,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -15,6 +15,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,6 +34,7 @@
"fqn": "MyNamespace\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -51,6 +53,7 @@
"fqn": "MyNamespace\\B->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -61,7 +64,7 @@
},
"containerName": "MyNamespace\\B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -72,6 +75,7 @@
"MyNamespace\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -90,6 +94,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -100,7 +105,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -5,6 +5,7 @@
"fqn": "MyClass",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -23,6 +24,7 @@
"fqn": "MyClass->mainPropertyName",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,7 +35,7 @@
},
"containerName": "MyClass"
},
"type__class": "phpDocumentor\\Reflection\\Types\\String_",
"type__tostring": "string",
"type": {},
"declarationLine": "protected $mainPropertyName;",
"documentation": "The name of the main property, or NULL if there is none."

View File

@ -5,6 +5,7 @@
"fqn": "MyClass",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -23,6 +24,7 @@
"fqn": "MyClass->mainPropertyName",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,7 +35,7 @@
},
"containerName": "MyClass"
},
"type__class": "phpDocumentor\\Reflection\\Types\\String_",
"type__tostring": "string",
"type": {},
"declarationLine": "protected $mainPropertyName;",
"documentation": "The name of the main property, or NULL if there is none."

View File

@ -12,6 +12,7 @@
"fqn": "TestNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "TestNamespace\\whatever()",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -40,7 +42,7 @@
},
"containerName": "TestNamespace"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"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."

View File

@ -12,6 +12,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -48,6 +50,7 @@
"fqn": "MyNamespace\\A::a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -58,7 +61,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "static function a() {",
"documentation": null

View File

@ -9,6 +9,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -12,6 +12,7 @@
"fqn": "A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "A::$a",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -40,7 +42,7 @@
},
"containerName": "A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\String_",
"type__tostring": "string",
"type": {},
"declarationLine": "static $a;",
"documentation": null

View File

@ -18,6 +18,7 @@
"fqn": "TestClass",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -36,6 +37,7 @@
"fqn": "TestClass::$testProperty",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -46,7 +48,7 @@
},
"containerName": "TestClass"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Array_",
"type__tostring": "\\TestClass[]",
"type": {},
"declarationLine": "public static $testProperty;",
"documentation": "Lorem excepteur officia sit anim velit veniam enim."

View File

@ -15,6 +15,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,6 +34,7 @@
"fqn": "MyNamespace\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -51,6 +53,7 @@
"fqn": "MyNamespace\\B->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -61,7 +64,7 @@
},
"containerName": "MyNamespace\\B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -72,6 +75,7 @@
"MyNamespace\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -90,6 +94,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -100,7 +105,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -15,6 +15,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,6 +34,7 @@
"fqn": "MyNamespace\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -51,6 +53,7 @@
"fqn": "MyNamespace\\B->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -61,7 +64,7 @@
},
"containerName": "MyNamespace\\B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -72,6 +75,7 @@
"MyNamespace\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -90,6 +94,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -100,7 +105,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -15,6 +15,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,6 +34,7 @@
"fqn": "MyNamespace\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -51,6 +53,7 @@
"fqn": "MyNamespace\\B->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -61,7 +64,7 @@
},
"containerName": "MyNamespace\\B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -72,6 +75,7 @@
"MyNamespace\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -90,6 +94,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -100,7 +105,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -6,6 +6,12 @@
"MyNamespace\\A->addTestFile()": [
"./self4.php"
],
"MyNamespace\\__DIR__": [
"./self4.php"
],
"__DIR__": [
"./self4.php"
],
"MyNamespace\\DS": [
"./self4.php"
],
@ -18,6 +24,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -36,6 +43,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -54,6 +62,7 @@
"fqn": "MyNamespace\\A::suite()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
@ -64,7 +73,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public static function suite()",
"documentation": null

View File

@ -9,6 +9,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -27,6 +28,7 @@
"fqn": "MyNamespace\\A",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -45,6 +47,7 @@
"fqn": "MyNamespace\\A->typesProvider()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -55,7 +58,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function typesProvider()",
"documentation": null

View File

@ -15,6 +15,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,6 +34,7 @@
"fqn": "MyNamespace\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -51,6 +53,7 @@
"fqn": "MyNamespace\\B->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -61,7 +64,7 @@
},
"containerName": "MyNamespace\\B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -72,6 +75,7 @@
"MyNamespace\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -90,6 +94,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -100,7 +105,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -15,6 +15,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,6 +34,7 @@
"fqn": "MyNamespace\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -51,6 +53,7 @@
"fqn": "MyNamespace\\B->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -61,7 +64,7 @@
},
"containerName": "MyNamespace\\B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -72,6 +75,7 @@
"MyNamespace\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -90,6 +94,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -100,7 +105,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -15,6 +15,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,6 +34,7 @@
"fqn": "MyNamespace\\B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -51,6 +53,7 @@
"fqn": "MyNamespace\\B->b()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -61,7 +64,7 @@
},
"containerName": "MyNamespace\\B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function b() {",
"documentation": null
@ -72,6 +75,7 @@
"MyNamespace\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -90,6 +94,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -100,7 +105,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -2,9 +2,6 @@
"references": {
"MyNamespace\\B": [
"./static4.php"
],
"static": [
"./static4.php"
]
},
"definitions": {
@ -12,6 +9,7 @@
"fqn": "MyNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -32,6 +30,7 @@
"MyNamespace\\B"
],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -50,6 +49,7 @@
"fqn": "MyNamespace\\A->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -60,7 +60,7 @@
},
"containerName": "MyNamespace\\A"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -0,0 +1,9 @@
<?php
class FooClass {
public static function staticFoo(): FooClass {
return new FooClass();
}
public function bar() { }
}

View File

@ -0,0 +1,68 @@
{
"references": {
"FooClass": [
"./staticMethodReturnType.php"
]
},
"definitions": {
"FooClass": {
"fqn": "FooClass",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
"name": "FooClass",
"kind": 5,
"location": {
"uri": "./staticMethodReturnType.php"
},
"containerName": ""
},
"type": null,
"declarationLine": "class FooClass {",
"documentation": null
},
"FooClass::staticFoo()": {
"fqn": "FooClass::staticFoo()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": true,
"canBeInstantiated": false,
"symbolInformation": {
"name": "staticFoo",
"kind": 6,
"location": {
"uri": "./staticMethodReturnType.php"
},
"containerName": "FooClass"
},
"type__tostring": "\\FooClass",
"type": {},
"declarationLine": "public static function staticFoo(): FooClass {",
"documentation": null
},
"FooClass->bar()": {
"fqn": "FooClass->bar()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
"name": "bar",
"kind": 6,
"location": {
"uri": "./staticMethodReturnType.php"
},
"containerName": "FooClass"
},
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function bar() { }",
"documentation": null
}
}
}

View File

@ -5,6 +5,7 @@
"fqn": "B",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -23,6 +24,7 @@
"fqn": "B->hi",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -33,7 +35,7 @@
},
"containerName": "B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Integer",
"type__tostring": "int",
"type": {},
"declarationLine": "public $hi;",
"documentation": null
@ -42,6 +44,7 @@
"fqn": "B->a()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -52,7 +55,7 @@
},
"containerName": "B"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "function a () {",
"documentation": null

View File

@ -9,6 +9,7 @@
"fqn": "SomeNamespace",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {

View File

@ -12,6 +12,7 @@
"fqn": "Foo",
"extends": [],
"isGlobal": true,
"roamed": false,
"isStatic": false,
"canBeInstantiated": true,
"symbolInformation": {
@ -30,6 +31,7 @@
"fqn": "Foo->bar",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -40,7 +42,7 @@
},
"containerName": "Foo"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type__tostring": "\\",
"type": {},
"declarationLine": "protected $bar;",
"documentation": null
@ -49,6 +51,7 @@
"fqn": "Foo->foo()",
"extends": [],
"isGlobal": false,
"roamed": false,
"isStatic": false,
"canBeInstantiated": false,
"symbolInformation": {
@ -59,7 +62,7 @@
},
"containerName": "Foo"
},
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed",
"type__tostring": "mixed",
"type": {},
"declarationLine": "public function foo () {",
"documentation": null