PsiCodeBlock (@NotNull PsiStatement thenBranch) { if (thenBranch instanceof PsiBlockStatement) return ((PsiBlockStatement)thenBranch).getCodeBlock(); PsiStatement statementInBlock = BlockUtils.expandSingleStatementToBlockStatement(thenBranch); return tryCast(statementInBlock.getParent(), PsiCodeBlock.class); }