boolean (PsiStatement statement) { final PsiIfStatement ifStatement = PsiTreeUtil.getParentOfType(statement, PsiIfStatement.class, true, PsiMethod.class, PsiLambdaExpression.class); if (ifStatement == null) { return false; } final PsiStatement elseBranch = ifStatement.getElseBranch(); return elseBranch != null && !PsiTreeUtil.isAncestor(elseBranch, statement, true); }