Make the type hinting error message slightly clearer when a class is expected.

Implements FR #65656 (Error message when type hinting is ambigious).