static @Nullable PsiType getDeclaredType(PsiMember member, PsiSubstitutor substitutor) {
    if (member instanceof PsiField field) {
      return substitutor.substitute(field.getType());
    }
    if (member instanceof PsiMethod method) {
      if (method.isConstructor()) {
        PsiClass aClass = Objects.requireNonNull(method.getContainingClass());
        return JavaPsiFacade.getElementFactory(method.getProject()).createType(aClass, substitutor);
      }
      return patchGetClass(method, substitutor.substitute(method.getReturnType()));
    }
    return null;
  }
static @Nullable PsiType getDeclaredType(PsiMember member, PsiSubstitutor substitutor)