-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Code snippet that reproduces the problem
/**
* @template T
* @param class-string<T> $typeName
* @param mixed $value
* @return T
*/
function cast($value, string $typeName) {
if (is_object($value) && get_class($value) === $typeName) {
return $value;
}
throw new RuntimeException();
}https://phpstan.org/r/78d89125-d555-48b2-82bf-1a1f2f7f31a2
Expected output
No issues
Actual output
Function cast() should return T but returns object
Reactions are currently unavailable