WordPress PHP now (mostly) conforms to WordPress Coding Standards

For 12 long years, the WordPress Coding Standards have stood as a beacon of hope, a promise that code written for WordPress will be easily readable, recognisable, and portable. Sadly, WordPress’ own PHP hasn’t lived up to that promise.

Until now.

Weighing in at a respectable 105,650 lines added, 77,558 lines removed, with an 11MB diff, [42343] fixes 94.8% of the coding standards issues in WordPress’ PHP.

The 5.2%

The remaining 5% of coding standards issues require manual intervention, which means that we’re going to start accepting coding standards patches in the near future. Please hold off on creating tickets and submitting patches for now, while we figure out the best way to manage it.

Existing Patches

Unfortunately, this change means that most patches currently on Trac will no longer apply cleanly – they’re going to need updating. It’s going to take a bit of experimenting to figure out the most efficient way to handle this, if you’re interested in this problem, please go ahead and experiment!

The Wider Ecosystem

In the process of preparing for this, there were a lot of bugs fixed and features implemented in WPCS, as well as upstream in the PHPCS project – this not only benefits the WordPress ecosystem, but the wider PHP ecosystem. Special props to @jrf for driving the bulk of these changes, both in WPCS and PHPCS!