Open your user-preferences, and add/edit the following settings:
{
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "UTF-8",
"rulers":
[
80
],
"shift_tab_unindent": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true,
"use_tab_stops": true,
"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?"
}
brew install php-code-sniffer
brew install php-cs-fixer
brew install phpmd
Install the codesniffer sublime-plugin via package-control (see readme from https://github.com/benmatselby/sublime-phpcs)
After that, check the package user-config. This is mine:
{
"phpcs_executable_path": "/usr/local/bin/phpcs",
"php_cs_fixer_executable_path": "/usr/local/bin/php-cs-fixer",
"phpmd_executable_path": "/usr/local/bin/phpmd",
"phpmd_run": true,
"phpcs_linter_run": true,
"phpcs_show_quick_panel": false,
"extensions_to_execute": ["install", "php", "module", "inc", "test"],
"phpcs_additional_args": {
"--standard": "Drupal",
"-n": ""
},
"show_debug": true,
}
So, one last piece is missing. The drupal standards.
- I download the coder-module from https://www.drupal.org/project/coder
- Then I move the folder
Drupal
insidecode_sniffer
to the codesniffer-directory/usr/local/Cellar/php-code-sniffer/1.5.5/CodeSniffer/Standards
(the version-number may differ, a symbolic link might work too)