Automagical Code Checking

PHP Quality Assurance tools for WordPress Projects

by David Arceneaux

“Given enough eyeballs, all problems are shallow”

— Linus Torvalds on the nature of open source software.

Other developers have been bitten by more/different things than you have been.

Problems with getting other eyeballs

  • Working on closed source

  • Not enough other people work in the same problem area

  • Reluctant about wasting others’ time

PHP Quality Assurance Toolchain

A set of projects curated at

I’ll be focusing on PHP Code Sniffer & PHP Mess Detector

These are command-line tools

PHP Mess Detector

Opinionated code critique tool

Analyses how you use variables, functions & classes

Best to install with Composer

PHP Code Sniffers

PHP Code Sniffer checks code formatting for

  • tabs vs spaces
  • levels of indentation
  • spaces around function inputs & operators

The makers recommend installation via PEAR, but Composer works too.

WordPress Sniffs

The WordPress Development Team has a set of sniffs for PHPCS, based on the project’s coding standards

The installation is involved, but there’s an effort to made it install by Composer


PHPCS & PHPMD are made to be command-line tools, but there are plenty of plugins made for your favorite text editor or development IDE.

My examples will be with Vim in the vim-phpqa plugin

Checks in WordPress

For new themes & plugins that are to be hosted on, they need to pass the tests coded in Theme Check and Plugin Check (though Plugin Check hasn’t been updated in a while)