I've a old codebase written in PHP 5.3, which I'm planning to migrate to PHP 5.6 (at least) or if possible, PHP 7.

Are there tools that can do static analysis of the code and give me a list of things to change, for migration? I can't do this manually as the code base has tens of thousands of files. I'd need to automate at least part of the process.

  • One tip for you - before you start write lots and lots of tests - that way you can make sure that the new code still runs at least as well as the old. Commented Aug 6, 2016 at 21:43
  • AFAIK, PHP 5.6 is backwards compatible with 5.3. Do you have counterexamples?
    – Ira Baxter
    Commented Aug 29, 2016 at 1:43
  • @IraBaxter magic quotes, for example. It has been removed from 5.4 onwards, right? There are thousands of queries that I need to fix
    – user1336
    Commented Aug 30, 2016 at 7:12
  • If you really plan on updating tens of thousands of files, wouldn't you want a tool that could actually make the changes? (At one minute each if you were lucky enough to be that fast it would take you a solid month, and it likely takes longer to checkout/edit/test/checkin) [Check my bio]
    – Ira Baxter
    Commented Aug 30, 2016 at 7:20
  • Do you a have reference to all the backwards compatibility breaking changes? The change log php.net/ChangeLog-5.php suggests several things that are deprecated, but it mostly doesn't say they are removed, and it doesn't mention magic quotes at all.
    – Ira Baxter
    Commented Aug 30, 2016 at 7:31

1 Answer 1


Two that come to mind are PHP Depend and PHP Mess Detector.

PHP Depend uses several software metrics to evaluate the code. PHP Mess Detector is a relatively new tool that takes a different approach by using a limited rule set to evaluate the code. PHP Depend requires PHP 5.2.3 while PHP Mess Detector requires 5.3.0.

Lastly, you may consider using the PHP “-l” command line option (syntax check) in an automated process.

  • While these may be useful tools for assessing code quality, they are not specifically useful with respect to OP's request.
    – Ira Baxter
    Commented Aug 14, 2016 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.