-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
phpstan/phpstan-src
#4184Description
Bug report
Sorry if I'm filing this in the wrong project, but it's a bit ambiguous what's causing the issue.
Since PHPStan 2.1.18 the following code will fail (regardless of Larastan or Laravel version).
class Test
{
public function __invoke(string $entrypoints): HtmlString
{
return new HtmlString($entrypoints);
}
}
\PHPStan\dumpType(app(Test::class)('')); // Dumped type: *ERROR*
\PHPStan\dumpType(app()->make(Test::class)('')); // Dumped type: Illuminate\Support\HtmlString What's really strange is that it will still work if we just stick the class instance in a variable first:
$a = app(Test::class);
\PHPStan\dumpType($a('')); // Dumped type: Illuminate\Support\HtmlString
$b = app()->make(Test::class);
\PHPStan\dumpType($b('')); // Dumped type: Illuminate\Support\HtmlString app() is a Laravel helper and it's return value is being resolved by Larastan.
Code snippet that reproduces the problem
No response
Expected output
Dumped type: Illuminate\Support\HtmlString
Did PHPStan help you today? Did it make you happy in any way?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels