The last piece in my attempt to set up an “as easy as it can get” Vagrant virtual machine has been resolving one of my most pressing needs: PHP linting.
PHPStorm and Sublime Text will do that using either the system version of PHP (
5.4 for me being on a Mac) or what PHPStorm calls “language level”. Lowest version is, though,
5.2 is not covered.
While simply running the code in a virtual server should do the trick for themes and plugins that task will be a little harder when it comes to Composer packages as those are more components of a plugin or theme then finite and self-contained parts.
For that task I’ve baked the
php-lint script into my one liner php LAMP stack version (original by Jeffrey Way) to allow me to symbolic link packages folders in the VM shared folder and run
in each of those. The output will filter all passing files and keep the error raising ones alone.
If a folder path is not passed the script will assume the current folder as the root on and will recursively proceed from there.