PsiPolyadicExpression (@NotNull PsiPolyadicExpression innerExpression, @NotNull PsiExpression operand, @NotNull Map<IElementType, IElementType[]> outerOperators) { PsiPolyadicExpression expression = ObjectUtils.tryCast(operand.getParent(), PsiPolyadicExpression.class); if (expression == null) return null; IElementType innerOperator = innerExpression.getOperationTokenType(); IElementType[] operators = outerOperators.get(innerOperator); if (operators == null) return null; IElementType outerOperator = expression.getOperationTokenType(); if (!ArrayUtil.contains(outerOperator, operators) || expression.getOperands().length < 2) return null; if (isSamePrecedence(innerOperator, outerOperator) && expression.getTokenBeforeOperand(operand) == null) return null; return expression; }