@Nullable
    private static AppendChain getCallBeforeStatement(@NotNull PsiStatement statement,
                                                      @NotNull PsiVariable receiver,
                                                      @NotNull List<PsiDeclarationStatement> declarationsToSkip) {
      PsiElement previous = PsiTreeUtil.skipWhitespacesAndCommentsBackward(statement);
      PsiDeclarationStatement previousDeclaration = tryCast(previous, PsiDeclarationStatement.class);
      while (previousDeclaration != null && declarationsToSkip.contains(previousDeclaration)) {
        previous = PsiTreeUtil.skipWhitespacesAndCommentsBackward(previousDeclaration);
        previousDeclaration = tryCast(previous, PsiDeclarationStatement.class);
      }
      return getAppendCallExpression(receiver, previous);
    }
@Nullable
    private static AppendChain getCallBeforeStatement(@NotNull PsiStatement statement,
                                                      @NotNull PsiVariable receiver,
                                                      @NotNull List<PsiDeclarationStatement> declarationsToSkip)