PsiElement (Match match, PsiElement replacedMatch) { if ((myNotNullConditionalCheck || myGenerateConditionalExit) && myOutputVariable != null) { ReturnValue returnValue = match.getOutputVariableValue(myOutputVariable); if (returnValue instanceof VariableReturnValue) { String varName = ((VariableReturnValue)returnValue).getVariable().getName(); LOG.assertTrue(varName != null, "returned variable name is null"); PsiStatement statement = PsiTreeUtil.getParentOfType(replacedMatch, PsiStatement.class, false); if (statement != null) { PsiStatement conditionalExit = myNotNullConditionalCheck ? generateNotNullConditionalStatement(varName) : generateConditionalExitStatement(varName); return statement.getParent().addAfter(conditionalExit, statement); } } } return replacedMatch; }