1
0
Fork 0

Made SymbolInformationFactory a static factory for consistency

pull/661/head
dantleech 2018-07-29 15:58:57 +01:00 committed by Daniel Leech
parent 6b819abe16
commit 81463c6ba7
2 changed files with 2 additions and 10 deletions

View File

@ -43,13 +43,6 @@ class DefinitionResolver
*/ */
private $signatureInformationFactory; private $signatureInformationFactory;
/**
* Creates SymbolInformation instances
*
* @var SymbolInformationFactory
*/
private $symbolInformationFactory;
/** /**
* @param ReadableIndex $index * @param ReadableIndex $index
*/ */
@ -59,7 +52,6 @@ class DefinitionResolver
$this->typeResolver = new TypeResolver; $this->typeResolver = new TypeResolver;
$this->docBlockFactory = DocBlockFactory::createInstance(); $this->docBlockFactory = DocBlockFactory::createInstance();
$this->signatureInformationFactory = new SignatureInformationFactory($this); $this->signatureInformationFactory = new SignatureInformationFactory($this);
$this->symbolInformationFactory = new SymbolInformationFactory();
} }
/** /**
@ -242,7 +234,7 @@ class DefinitionResolver
} }
} }
$def->symbolInformation = $this->symbolInformationFactory->fromNode($node, $fqn); $def->symbolInformation = SymbolInformationFactory::fromNode($node, $fqn);
if ($def->symbolInformation !== null) { if ($def->symbolInformation !== null) {
$def->type = $this->getTypeFromNode($node); $def->type = $this->getTypeFromNode($node);

View File

@ -18,7 +18,7 @@ class SymbolInformationFactory
* @param string $fqn If given, $containerName will be extracted from it * @param string $fqn If given, $containerName will be extracted from it
* @return SymbolInformation|null * @return SymbolInformation|null
*/ */
public function fromNode($node, string $fqn = null):? SymbolInformation public static function fromNode($node, string $fqn = null):? SymbolInformation
{ {
$symbol = new SymbolInformation(); $symbol = new SymbolInformation();
if ($node instanceof Node\Statement\ClassDeclaration) { if ($node instanceof Node\Statement\ClassDeclaration) {