Refactoring #7: Upping the coding style game in PHP using Rector

Upgrades I absolutely love

We’ll start with some top-notch improvements that I think we should apply to every PHP project.

New line after statement

Separate multiple use statements

Simplify quote escaping

Wrap variables in curly braces

Convert switch to if-else

Match catch exceptions with their types

Inherited method same visibility as parent

Upgrades I have mixed feelings for

Static arrow functions and closures

Convert post increments to pre increments

Convert inline variables to sprintfs

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Geni Jaho

Geni Jaho

Full-stack web developer with a passion for software architecture and programming best practices.