boolean (PsiLocalVariable var, PsiExpression initializer, PsiMethodCallExpression nextCall) { if (initializer == null) return false; PsiExpression qualifier = getDeepQualifier(nextCall); if (!ExpressionUtils.isReferenceTo(qualifier, var)) return false; PsiType type = nextCall.getType(); if (type == null || !type.equals(initializer.getType())) return false; if (ReferencesSearch.search(var, new LocalSearchScope(nextCall)).findAll().size() > 1) return false; qualifier.replace(initializer); initializer.replace(nextCall); return true; }