1
0
Fork 0

Fix docblock union types

pull/412/head
Felix Becker 2017-06-15 17:03:25 +02:00
parent 3b633369a7
commit 4a98afe540
2 changed files with 10 additions and 10 deletions

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 // 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; // - [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 ( if (
($declaration = ParserHelpers\tryGetPropertyDeclaration($node)) && ($elements = $declaration->propertyElements) || ($declaration = ParserHelpers\tryGetPropertyDeclaration($node)) && ($elements = $declaration->propertyElements) ||
($declaration = ParserHelpers\tryGetConstOrClassConstDeclaration($node)) && ($elements = $declaration->constElements) ($declaration = ParserHelpers\tryGetConstOrClassConstDeclaration($node)) && ($elements = $declaration->constElements)
@ -131,7 +131,7 @@ class DefinitionResolver
* Gets Doc Block with resolved names for a Node * Gets Doc Block with resolved names for a Node
* *
* @param Node $node * @param Node $node
* @return DocBlock | null * @return DocBlock|null
*/ */
private function getDocBlock(Node $node) private function getDocBlock(Node $node)
{ {
@ -482,8 +482,8 @@ class DefinitionResolver
/** /**
* Returns the assignment or parameter node where a variable was defined * Returns the assignment or parameter node where a variable was defined
* *
* @param Node\Expression\Variable | Node\Expression\ClosureUse $var The variable access * @param Node\Expression\Variable|Node\Expression\ClosureUse $var The variable access
* @return Node\Expression\Assign | Node\Expression\AssignOp|Node\Param | Node\Expression\ClosureUse|null * @return Node\Expression\Assign|Node\Expression\AssignOp|Node\Param|Node\Expression\ClosureUse|null
*/ */
public function resolveVariableToNode($var) public function resolveVariableToNode($var)
{ {
@ -894,7 +894,7 @@ class DefinitionResolver
* Takes any class name node (from a static method call, or new node) and returns a Type object * 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 * Resolves keywords like self, static and parent
* *
* @param Node | PhpParser\Token $class * @param Node|PhpParser\Token $class
* @return Type * @return Type
*/ */
public function resolveClassNameToType($class): Type public function resolveClassNameToType($class): Type
@ -1191,9 +1191,9 @@ class DefinitionResolver
} }
/** /**
* @param DocBlock | null $docBlock * @param DocBlock|null $docBlock
* @param string | null $variableName * @param string|null $variableName
* @return DocBlock\Tags\Param | null * @return DocBlock\Tags\Param|null
*/ */
private function tryGetDocBlockTagForParameter($docBlock, $variableName) private function tryGetDocBlockTagForParameter($docBlock, $variableName)
{ {

View File

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