private static @Nullable PsiMethod findMethodToFix(PsiElement element) {
    if (element instanceof PsiMethod method) {
      return method;
    }
    final PsiElement parent = element.getParent();
    if (parent instanceof PsiMethodCallExpression methodCall) {
      return methodCall.resolveMethod();
    }
    return null;
  }
private static @Nullable PsiMethod findMethodToFix(PsiElement element)