In California the law is to ride as far to the right as is safe. I interpret that as being 1 car door length away from parked cars. A cop with too much time on their hands may disagree with you, but do it anyway and fight the ticket.
I don’t mean to be blaming the cyclist here, the person in the car should have definitely looked before opening the door. That’s just reckless behavior on a busy city street.