You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-3Lines changed: 13 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -69,9 +69,19 @@ For Win OS you should be using `\` as separator:
69
69
vendor\bin\sniff -v
70
70
```
71
71
72
-
#### Hook it into your IDE for live-correction
73
-
You can easily make a "watcher" for your IDE, so any file you work on, will be auto-corrected when (auto-)saving.
74
-
For PHPStorm, for example, make sure you switch `Show Console` to `never` to not be disturbed by it all the time.
72
+
#### Include it in your IDE via hotkey
73
+
E.g. for PHPStorm:
74
+
* Open Settings -> Tools -> External Tools
75
+
* Add a new tool named "cs-sniffer" and set Program to `$ProjectFileDir$/vendor/bin/phpcs`, Parameters to `--standard=$ProjectFileDir$/vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml -p $FilePath$` and Working directoy to `$ProjectFileDir$`.
76
+
* Add a new tool named "cs-fixer" and set Program to `$ProjectFileDir$/vendor/bin/phpcbf`, Parameters to `--standard=$ProjectFileDir$/vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml -v $FilePath$` and Working directoy to `$ProjectFileDir$`.
77
+
* Optionally uncheck "Open console" if you don't want to see any output here for the fixer.
78
+
* Now set up your hotkeys under Settings -> Keymap (search for cs-sniffer and cs-fixer). E.g. `Control + Comma` for sniffing, and `Control + Dot` for fixing.
79
+
80
+
##### Hook it into your IDE for live-correction
81
+
You can also easily make a "watcher" for your IDE, so any file you work on, will be auto-corrected when (auto-)saving.
82
+
But here you should better only whitelist certain sniffs that only add things and don't remove anything.
83
+
84
+
Note: For PHPStorm, for example, make sure you switch `Show Console` to `never` to not be disturbed by it all the time.
75
85
76
86
### Writing new sniffs
77
87
You can contribute by adding new sniffs as per PSR-2-R standard.
0 commit comments