Crowdcube PHP_Codesniffer Standard
It currently does not check/enforce all, but serves as a good first check to the Crowdcube coding standard. The remaining checks will be picked up in code review.
Add the following to your
composer.json require and update:
./vendor/bin/phpcs from your project, set the standard as follows:
You can configure PHP Storm to automatically check using this standard.
Use the following command to install:
pear install PHP_CodeSniffer-2.5.0
- Visit the Code Sniffer configuration panel: Preferences > Languages & Frameworks > PHP > Code Sniffer
- In the drop-down, select 'Local' configuration, then click the [ ... ] button
- The new window will house another [ ... ] button which'll allow you to point the IDE to your bin file for
- Visit the Inspector configuration panel: Preferences > Editor > Inspections
- Find 'PHP CodeSniffer validation' beneath the PHP tab
- Customise the severity and error reporting to your liking
- In the 'Code Standard' drop down, change it to 'Custom'
- Click the [ ... ] button, and in the new window, add the path to this repository's 'Crowdcube' directory
Now any php files you open will be checked by the sniffer and you will be alerted to your chosen level of severity.