Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
Updated reame with details on PHPStorm setup and command line usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
wpscholar committed Jan 7, 2019
1 parent 3cd8eb1 commit 253f360
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Add any extra PHP Code Sniffer configuration options to your composer.json file
}
```

## Usage

Run `vendor/bin/phpcs .` from the project root to run checks.

See the [PHP Code Sniffer wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki) for more details.

## IDE Integration
Some IDE integrations of PHPCS will fail to register your ruleset since it doesn't live in your project root. In order to rectify this, place phpcs.xml at your project root:

Expand All @@ -26,3 +32,16 @@ Some IDE integrations of PHPCS will fail to register your ruleset since it does
<rule ref="Bluehost" />
</ruleset>
```

### PHPStorm Setup

1. Open up the preferences panel.
2. Go to "Languages & Frameworks" > "PHP" > "Code Sniffer".
3. Ensure the "Configuration" section has "Local" set in the dropdown. Click the "..." button.
4. Set the "PHP Code Sniffer path" to be "{projectRoot}/vendor/bin/phpcs" where "{projectRoot}" is the actual path of your project root.
5. Hit "OK".
6. Go to "Editor" > "Inspections" in the preference panel.
7. Click on "PHP Code Sniffer validation" under the "PHP" > "Quality tools" section.
8. Hit the refresh button next to the "Coding Standard" field on the right.
9. Select "Bluehost" from the dropdown.
10. Hit "OK" to exit the preferences panel.

0 comments on commit 253f360

Please sign in to comment.