private static @Nullable PsiExpression expandLastIfDisjunct(PsiPolyadicExpression orChain,
                                                              PsiExpression subExpression,
                                                              PsiElementFactory factory) {
    PsiIfStatement ifStatement = ObjectUtils.tryCast(PsiUtil.skipParenthesizedExprUp(orChain.getParent()), PsiIfStatement.class);
    if (ifStatement == null) return null;
    PsiExpression lastOperand = ArrayUtil.getLastElement(orChain.getOperands());
    if (!PsiTreeUtil.isAncestor(lastOperand, subExpression, false)) return null;
    orChain.replace(SplitConditionUtil.getLOperands(orChain, Objects.requireNonNull(orChain.getTokenBeforeOperand(lastOperand))));
    ControlFlowUtils.ensureElseBranch(ifStatement);
    PsiBlockStatement elseBranch = (PsiBlockStatement)Objects.requireNonNull(ifStatement.getElseBranch());
    PsiCodeBlock codeBlock = elseBranch.getCodeBlock();
    PsiStatement replacement = factory.createStatementFromText("if(" + subExpression.getText() + ");", ifStatement);
    PsiIfStatement alwaysFalseIf = (PsiIfStatement)codeBlock.addAfter(replacement, codeBlock.getLBrace());
    return Objects.requireNonNull(alwaysFalseIf.getCondition());
  }
private static @Nullable PsiExpression expandLastIfDisjunct(PsiPolyadicExpression orChain,
                                                              PsiExpression subExpression,
                                                              PsiElementFactory factory)