PsiLocalVariable (PsiMethod methodCopy, PsiReference callSite, PsiType returnType) { if (callSite.getElement().getParent() instanceof PsiMethodCallExpression && ExpressionUtils.isVoidContext((PsiExpression)callSite.getElement().getParent())) { InlineUtil.extractReturnValues(methodCopy, false); returnType = PsiTypes.voidType(); } PsiCodeBlock block = Objects.requireNonNull(methodCopy.getBody()); List<PsiReturnStatement> returns = Arrays.asList(PsiUtil.findReturnStatements(block)); FinishMarker marker = FinishMarker.defineFinishMarker(block, returnType, returns); return ConvertToSingleReturnAction.convertReturns(methodCopy.getProject(), block, returnType, marker, returns.size(), new EmptyProgressIndicator()); }