As a programmer, I’d prefer a combination of the two: Dr Johnson kicked a large rock and said, as his foot rebounded, “I refute it thus.”. as I think it’s weird that a punctuation mark inside a quote can end the sentence that contains the quote. I’d argue like this: in the above case there are two sentences, the quote and the sentence that contains the quote. Both need to be terminated with a period.
I don't care what other people think, this is the only thing that makes sense if you ask me.