if (pl.toString().equals("Return")) {
PsiElement[] pl2 = pl.getChildren();
if (pl2.length > 0 && pl2[0].toString().equals("Array creation expression")) {
ArrayCreationExpressionImpl ar = (ArrayCreationExpressionImpl) pl2[0];
ArrayHashElement p = (ArrayHashElement) PhpPsiElementFactory.createFromText(project,
PhpElementTypes.HASH_ARRAY_ELEMENT,
"array('" + string + "'=>'')");
PsiElement closingBrace = ar.getLastChild();
String preLast = closingBrace.getPrevSibling().toString();
if (!preLast.equals("Comma")) {
pf.getViewProvider().getDocument().insertString(
closingBrace.getTextOffset(), "," + lineSeparator + p.getText());
}
}
break;
}
}