private static @Nullable PsiVariable getVariable(PsiStatement statement) {
    if (!(statement instanceof PsiExpressionStatement expressionStatement)) {
      return null;
    }
    final PsiExpression expression = expressionStatement.getExpression();
    if (!(expression instanceof PsiMethodCallExpression methodCallExpression)) {
      return null;
    }
    return getVariable(methodCallExpression);
}
private static @Nullable PsiVariable getVariable(PsiStatement statement)