@Override
  public boolean isApplicable(PsiExpression expr) {
    PsiType type = expr.getType();
    if (!(type != null && (PsiTypes.booleanType().equals(type) || PsiTypes.booleanType().equals(PsiPrimitiveType.getUnboxedType(type))))) return false;
    if (!expr.isPhysical()) return false;
    PsiElement expressionStatement = expr.getParent();
    if (!(expressionStatement instanceof PsiExpressionStatement)) return false;

    PsiElement statementParent = expressionStatement.getParent();
    if (!isElseBranch(expr, statementParent) &&
        !(statementParent instanceof PsiCodeBlock) &&
        !(FileTypeUtils.isInServerPageFile(statementParent) && statementParent instanceof PsiFile)) {
      return false;
    }
    return true;
  }
@Override
  public boolean isApplicable(PsiExpression expr)