Skip to content

Commit

Permalink
Merge branch '3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Feb 26, 2017
2 parents 9cd9c0c + 1b59e91 commit dce34f3
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/PhpParser/NodeVisitor/NameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,20 @@ protected function addAlias(Stmt\UseUse $use, $type, Name $prefix = null) {
/** @param Stmt\Function_|Stmt\ClassMethod|Expr\Closure $node */
private function resolveSignature($node) {
foreach ($node->params as $param) {
if ($param->type instanceof Name) {
$param->type = $this->resolveClassName($param->type);
}
$param->type = $this->resolveType($param->type);
}
$node->returnType = $this->resolveType($node->returnType);
}

private function resolveType($node) {
if ($node instanceof Node\NullableType) {
$node->type = $this->resolveType($node->type);
return $node;
}
if ($node->returnType instanceof Name) {
$node->returnType = $this->resolveClassName($node->returnType);
if ($node instanceof Name) {
return $this->resolveClassName($node);
}
return $node;
}

/**
Expand Down

0 comments on commit dce34f3

Please sign in to comment.