boolean (@NotNull PsiMethodCallExpression expression, @NotNull PsiVariable variable, @NotNull @NonNls String methodName) { final PsiReferenceExpression methodExpression = expression.getMethodExpression(); @NonNls final String name = methodExpression.getReferenceName(); if (!methodName.equals(name)) { return false; } final PsiExpression qualifier = PsiUtil.skipParenthesizedExprDown(methodExpression.getQualifierExpression()); if (!(qualifier instanceof PsiReferenceExpression referenceExpression)) { return false; } final PsiElement element = referenceExpression.resolve(); return variable.equals(element); }