boolean (PsiIfStatement statement1, PsiIfStatement statement2) { final PsiStatement thenBranch = statement1.getThenBranch(); final PsiStatement elseBranch = statement1.getElseBranch(); if (thenBranch == null) { return false; } final PsiExpression firstCondition = statement1.getCondition(); final PsiExpression secondCondition = statement2.getCondition(); if (!EquivalenceChecker.getCanonicalPsiEquivalence().expressionsAreEquivalent(firstCondition, secondCondition)) { return false; } final PsiStatement nextThenBranch = statement2.getThenBranch(); if (!canBeMerged(thenBranch, nextThenBranch)) { return false; } final PsiStatement nextElseBranch = statement2.getElseBranch(); return elseBranch == null || nextElseBranch == null || canBeMerged(elseBranch, nextElseBranch); }