@SafeVarargs
  @Contract("null, _, _ -> null")
  public static @Nullable <T extends PsiElement> T getParentOfType(@Nullable PsiElement element, boolean strict,
                                                                   @NotNull Class<? extends T> @NotNull ... classes) {
    PsiElement run;
    if (strict) {
      if (element == null || element instanceof PsiFile) return null;
      run = element.getParent();
    } else {
      run = element;
    }

    while (run != null) {
      if (instanceOf(run, classes)) {
        //noinspection unchecked
        return (T)run;
      }
      if (run instanceof PsiFile) break;
      run = run.getParent();
    }

    return null;
  }
@SafeVarargs
  @Contract("null, _, _ -> null")
  public static @Nullable <T extends PsiElement> T getParentOfType(@Nullable PsiElement element, boolean strict,
                                                                   @NotNull Class<? extends T> @NotNull ... classes)