Existing product developed in core PHP is built in PHP 5.2 and now we want to migrate the product to PHP 5.4.
CodeSniffer can detect compatibility for version and generate report with warnings and errors.
Current approach could be:
Scan whole product and get report from CodeSniffer
Prepare a plan to fix each type of warning or error, like replace
ereg_replace
withpreg_replace
function and in first argument add delimiters-
Example:
Original: $new = ereg_replace(“oldstring“, “newstring“, $old); Replace: $new = preg_replace(“/oldstring/“, “newstring“, $old);
Make a PHP script to implement the plan
Run the script, test with CodeSniffer again and run a test on whole product again
Is there any better tool or approach for migration PHP 5.2 to PHP 5.4?