PsiElement (@NotNull PsiElement expression) { if (expression instanceof PsiMethodCallExpression) { return ((PsiMethodCallExpression)expression).getMethodExpression().getQualifierExpression(); } if (expression instanceof PsiArrayAccessExpression) { while (expression instanceof PsiArrayAccessExpression) { expression = ((PsiArrayAccessExpression)expression).getArrayExpression(); } return expression; } return null; }