Since you are working with dynamic language, step 2 should include adding type annotations or whatever they are called in php. Specifying stricter types makes refactoring much easier.
function foo(string $bar) { ... }
foo(1234) // kaboom?<?php //Enter your code here, enjoy!
function foo(string $bar) { return $bar . $bar; }
echo foo(1234);
To get the true benefits of typing you should also run a static type analyzer.