-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Description
Bug report
PHPStan should be able to infer the return type in the attached snippet, but it isn't. I get the error
Method Thing::toOther() return type has no value type specified in iterable type array.
/**
* @template T
*/
trait Convertable
{
/**
* @return T
*/
abstract public function toOther(): mixed;
}
final class Thing
{
/** @use Convertable<list<never>> */
use Convertable;
public function toOther(): array
{
return [];
}
}Code snippet that reproduces the problem
https://phpstan.org/r/075b68e3-a4d1-4d5f-bbe6-5b6afeec8137
Expected output
No errors
Did PHPStan help you today? Did it make you happy in any way?
No response
Reactions are currently unavailable