1
0
Fork 0

updated doc blocks

pull/421/head
Ivan Bozhanov 2017-07-07 12:30:04 +03:00
parent 2036f3b958
commit cc8e253fba
2 changed files with 10 additions and 6 deletions

View File

@ -14,6 +14,7 @@ use LanguageServer\Protocol\{
}; };
use Microsoft\PhpParser; use Microsoft\PhpParser;
use Microsoft\PhpParser\Node; use Microsoft\PhpParser\Node;
use Generator;
class CompletionProvider class CompletionProvider
{ {
@ -374,9 +375,9 @@ class CompletionProvider
* Adds the FQNs of all parent classes to an array of FQNs of classes * Adds the FQNs of all parent classes to an array of FQNs of classes
* *
* @param string[] $fqns * @param string[] $fqns
* @return string[] * @return Generator
*/ */
private function expandParentFqns(array $fqns) private function expandParentFqns(array $fqns) : Generator
{ {
foreach ($fqns as $fqn) { foreach ($fqns as $fqn) {
yield $fqn; yield $fqn;

View File

@ -7,6 +7,7 @@ use LanguageServer\Index\ReadableIndex;
use phpDocumentor\Reflection\{Types, Type, Fqsen, TypeResolver}; use phpDocumentor\Reflection\{Types, Type, Fqsen, TypeResolver};
use LanguageServer\Protocol\SymbolInformation; use LanguageServer\Protocol\SymbolInformation;
use Exception; use Exception;
use Generator;
/** /**
* Class used to represent symbols * Class used to represent symbols
@ -98,16 +99,18 @@ class Definition
public $documentation; public $documentation;
/** /**
* Gets the definitons of all ancestor classes * Yields the definitons of all ancestor classes (the Definition fqn is yielded as key)
* *
* @return Definition[] * @param ReadableIndex $index the index to search for needed definitions
* @param bool $includeSelf should the first yielded value be the current definition itself
* @return Generator
*/ */
public function getAncestorDefinitions(ReadableIndex $index, bool $includeSelf = false) public function getAncestorDefinitions(ReadableIndex $index, bool $includeSelf = false) : Generator
{ {
if ($includeSelf) { if ($includeSelf) {
yield $this->fqn => $this; yield $this->fqn => $this;
} }
if (is_array($this->extends)) { if ($this->extends !== null) {
// iterating once, storing the references and iterating again // iterating once, storing the references and iterating again
// guarantees that closest definitions are yielded first // guarantees that closest definitions are yielded first
$definitions = []; $definitions = [];