A few days ago, I came across a How to Apply Nette Coding Standard in Your Project blog post and I fell in love. That was exactly what I was looking for! The only problem is that I do not have PHP 7.1 installed (I have got PHP 7.0) and I cannot update (at least not easily without breaking things).

Solution

Recently, I was fiddling with Vagrant. Therefore, I used gained knowledge to set up a simple vagrant project solving my problem.

Usage

Synchronize project folder

Add project folder, you want to check, to Vagrantfile:

Vagrant.configure("2") do |config|
  ...
  config.vm.synced_folder "path/to/project-to-check", "/vagrant_data/project-to-check"
  ...
end

Note: You can add multiple project folders

Style check & fix

Now run Vagrant and connect via SSH.

$ vagrant up
$ vagrant ssh

Once you are connected via SSH move to /vagrant folder and run check&fix.

$ ./ecs check /vagrant_data/project-to-check/app/ --config vendor/nette/coding-standard/coding-standard-php70.neon --fix

For more details read tool documentation.

For whom is this?

This solution is for people who for some reason do not have PHP ≥7.1 installed and still want to check&fix their PHP coding style according to Nette Coding Standards.


Sources