Review and next steps

We have now made great strides in modernizing our application. Removing global and new keywords in favor of dependency injections has already improved the quality of the codebase and made tracking down bugs a lot easier, if only because modifying a variable over here no longer causes a variable over there to be affected at a distance. Our page scripts might be somewhat longer, because we have to create the dependencies, but we can now see exactly what parts of the system we are interacting with much more clearly.

Our next step is to examine our newly refactored classes and start writing tests for them. That way, when we start making changes to the classes, we will know if we broke any previously existing behavior.

Get Modernizing Legacy Applications in PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.