Skip to content

Commit

Permalink
Fix prefixing of function return typehints (#163)
Browse files Browse the repository at this point in the history
Return typehints are now properly resolved and prefixed when necessary.
  • Loading branch information
theofidry authored Feb 18, 2018
1 parent f944445 commit a44080a
Show file tree
Hide file tree
Showing 5 changed files with 369 additions and 41 deletions.
64 changes: 41 additions & 23 deletions specs/func-declaration/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,36 @@ class Y {}
use ArrayIterator;
function foo(
Foo $arg0,
\Foo $arg1,
Foo\Bar $arg2,
\Foo\Bar $arg3,
ArrayIterator $arg4,
\ArrayIterator $arg5,
X\Y $arg6,
\X\Y $arg7
string $arg0,
?string $arg1,
?string $arg2 = null,
Foo $arg3,
?Foo $arg4,
Foo $arg5 = null,
\Foo $arg6,
?\Foo $arg7,
\Foo $arg8 = null,
Foo\Bar $arg9,
?Foo\Bar $arg10,
Foo\Bar $arg11 = null,
\Foo\Bar $arg7,
?\Foo\Bar $arg12,
\Foo\Bar $arg13 = null,
ArrayIterator $arg14,
?ArrayIterator $arg15,
?ArrayIterator $arg16 = null,
\ArrayIterator $arg17,
?\ArrayIterator $arg18,
\ArrayIterator $arg19 = null,
X\Y $arg20,
\X\Y $arg21
) {}
}
Expand All @@ -146,7 +168,7 @@ class_alias('Humbug\\X\\Y', 'X\\Y', \false);
use Humbug\Foo;
use ArrayIterator;
function foo(\Humbug\Foo $arg0, \Humbug\Foo $arg1, \Humbug\Foo\Bar $arg2, \Humbug\Foo\Bar $arg3, \ArrayIterator $arg4, \ArrayIterator $arg5, \Humbug\X\Y $arg6, \Humbug\X\Y $arg7)
function foo(string $arg0, ?string $arg1, ?string $arg2 = null, \Humbug\Foo $arg3, ?\Humbug\Foo $arg4, \Humbug\Foo $arg5 = null, \Humbug\Foo $arg6, ?\Humbug\Foo $arg7, \Humbug\Foo $arg8 = null, \Humbug\Foo\Bar $arg9, ?\Humbug\Foo\Bar $arg10, \Humbug\Foo\Bar $arg11 = null, \Humbug\Foo\Bar $arg7, ?\Humbug\Foo\Bar $arg12, \Humbug\Foo\Bar $arg13 = null, \ArrayIterator $arg14, ?\ArrayIterator $arg15, ?\ArrayIterator $arg16 = null, \ArrayIterator $arg17, ?\ArrayIterator $arg18, \ArrayIterator $arg19 = null, \Humbug\X\Y $arg20, \Humbug\X\Y $arg21)
{
}

Expand Down Expand Up @@ -182,7 +204,6 @@ class Y {}
use ArrayIterator;
function foo(): void {}
function foo(): null {}
function foo(): bool {}
function foo(): ?bool {}
Expand Down Expand Up @@ -246,9 +267,6 @@ class_alias('Humbug\\X\\Y', 'X\\Y', \false);
function foo() : void
{
}
function foo() : null
{
}
function foo() : bool
{
}
Expand Down Expand Up @@ -291,40 +309,40 @@ function foo() : callable
function foo() : ?callable
{
}
function foo() : Foo
function foo() : \Humbug\Foo
{
}
function foo() : \Foo
function foo() : \Humbug\Foo
{
}
function foo() : ?Foo
function foo() : ?\Humbug\Foo
{
}
function foo() : ?\Foo
function foo() : ?\Humbug\Foo
{
}
function foo() : ArrayIterator
function foo() : \ArrayIterator
{
}
function foo() : \ArrayIterator
{
}
function foo() : ?ArrayIterator
function foo() : ?\ArrayIterator
{
}
function foo() : ?\ArrayIterator
{
}
function foo() : X\Y
function foo() : \Humbug\X\Y
{
}
function foo() : \X\Y
function foo() : \Humbug\X\Y
{
}
function foo() : ?X\Y
function foo() : ?\Humbug\X\Y
{
}
function foo() : ?\X\Y
function foo() : ?\Humbug\X\Y
{
}

Expand Down
Loading

0 comments on commit a44080a

Please sign in to comment.