PHP4 to PHP5 class migration script

Although PHP5 is out there for a while migration projects from PHP4 is still a present and challenging task for many web developers. Facing such a migration project I found it not very amazing to rewrite all class method definitions by hand – especially, cause I didn’t know every usage of the methods in the tons of PHP files making use of the classes.
Driven by the fear of becoming a code rewriting monkey I wrote a litte helper script. This script looks for the static usage of class methods and rewrites all method definition in the class files if their usage was found. The next step would be to search for explicit non-static, public and private use to adress all kind of usages. The rewritten class is stored in a .php.REWRITTEN named file.

Feel free to extend the script – I would be happy if you’d share your enhancements ;)

Perl Script for rewriting PHP4 to PHP5 classes

This entry was posted in Werkzeuge. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>