diff --git a/lib/PhpParser/NodeVisitor/NameResolver.php b/lib/PhpParser/NodeVisitor/NameResolver.php index cfe8ce7..2d466d1 100644 --- a/lib/PhpParser/NodeVisitor/NameResolver.php +++ b/lib/PhpParser/NodeVisitor/NameResolver.php @@ -91,6 +91,7 @@ class NameResolver extends NodeVisitorAbstract $this->resolveSignature($node); } elseif ($node instanceof Stmt\ClassMethod || $node instanceof Expr\Closure + || $node instanceof Expr\ArrowFunction ) { $this->resolveSignature($node); } elseif ($node instanceof Stmt\Property) { diff --git a/test/PhpParser/NodeVisitor/NameResolverTest.php b/test/PhpParser/NodeVisitor/NameResolverTest.php index 571eaae..ec09699 100644 --- a/test/PhpParser/NodeVisitor/NameResolverTest.php +++ b/test/PhpParser/NodeVisitor/NameResolverTest.php @@ -219,6 +219,10 @@ function(A $a) : A {}; function fn3(?A $a) : ?A {} function fn4(?array $a) : ?array {} +fn(array $a): array => $a; +fn(A $a): A => $a; +fn(?A $a): ?A => $a; + A::b(); A::$b; A::B; @@ -263,6 +267,9 @@ function fn3(?\NS\A $a) : ?\NS\A function fn4(?array $a) : ?array { } +fn(array $a): array => $a; +fn(\NS\A $a): \NS\A => $a; +fn(?\NS\A $a): ?\NS\A => $a; \NS\A::b(); \NS\A::$b; \NS\A::B;