Bug report
enum IndexBy {
case A;
case B;
}
/**
* @template T of IndexBy|null
* @param T $indexBy
* @return (T is null ? null : string)
*/
function run(?IndexBy $indexBy = null): ?string
{
return match ($indexBy) {
IndexBy::A => 'by A',
IndexBy::B => 'by B',
null => null,
};
}
Error: Match expression does not handle remaining value: T of mixed
Seems, this bug is similar to #12998
Code snippet that reproduces the problem
https://phpstan.org/r/3448c780-b995-4e14-9ec2-9c37d01b7d6f
Expected output
No errors
Did PHPStan help you today? Did it make you happy in any way?
No response