Well, I've heard you have plenty of experience with Unit Testing and TDD. Perhaps designing a few tests before refactoring?
I've heard of Snapshot testing, but have never tried it: https://github.com/spatie/phpunit-snapshot-assertions
Also, what kind of refactor are you trying to do?
Screenshot where text in square brackets is duplicated once again