mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-30 04:29:15 +01:00
Resolve return type of arrow functions (#613)
This commit is contained in:
parent
1bd73cc04c
commit
624f71fa6f
@ -91,6 +91,7 @@ class NameResolver extends NodeVisitorAbstract
|
|||||||
$this->resolveSignature($node);
|
$this->resolveSignature($node);
|
||||||
} elseif ($node instanceof Stmt\ClassMethod
|
} elseif ($node instanceof Stmt\ClassMethod
|
||||||
|| $node instanceof Expr\Closure
|
|| $node instanceof Expr\Closure
|
||||||
|
|| $node instanceof Expr\ArrowFunction
|
||||||
) {
|
) {
|
||||||
$this->resolveSignature($node);
|
$this->resolveSignature($node);
|
||||||
} elseif ($node instanceof Stmt\Property) {
|
} elseif ($node instanceof Stmt\Property) {
|
||||||
|
@ -219,6 +219,10 @@ function(A $a) : A {};
|
|||||||
function fn3(?A $a) : ?A {}
|
function fn3(?A $a) : ?A {}
|
||||||
function fn4(?array $a) : ?array {}
|
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;
|
A::$b;
|
||||||
A::B;
|
A::B;
|
||||||
@ -263,6 +267,9 @@ function fn3(?\NS\A $a) : ?\NS\A
|
|||||||
function fn4(?array $a) : ?array
|
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;
|
\NS\A::$b;
|
||||||
\NS\A::B;
|
\NS\A::B;
|
||||||
|
Loading…
Reference in New Issue
Block a user