Finding PHP4 constructors in Eclipse

With PHP5.3.3 its time to remove some dust from your old code. Aside of the fact that most of us would want to look into legacy projects, checking for issues someone else has solved more elegantly in the meantime, support for the old contructor names (a function identical to the class name) will be dropped. This means the old code will have to be ported.

As I am not a friend of automated code modification I searched for a way to find concerned classes via the Eclipse file search – using regular expression. This should do…

(?s)^(class\s+(\w+)\b.*^\s+function\s+)\2\b

Leave a Reply

You must be logged in to post a comment.