PsiExpression (@Nullable PsiStatement block) { if (block == null) return null; PsiStatement statement = ControlFlowUtils.stripBraces(block); PsiReturnStatement returnStatement = tryCast(statement, PsiReturnStatement.class); if (returnStatement == null) return null; return returnStatement.getReturnValue(); }