WordPress を使った開発を行う時の、PhpStorm の設定メモ。
$ brew install php56
$ brew install composer --ignore-dependencies
$ brew install wp-cli --ignore-dependencies
$ brew install php-code-sniffer
$ git clone https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git --depth=1 /usr/local/Cellar/php-code-sniffer/2.3.4/CodeSniffer/Standards/wpcs
$ phpcs --config-set installed_paths /usr/local/Cellar/php-code-sniffer/2.3.4/CodeSniffer/Standards/wpcs
$ phpcs -i
$ cd ${HOME}/Library/Preferences/PhpStorm2017.2/codestyles/
$ curl -LOk https://raw.githubusercontent.com/Automattic/PhpStorm-Resources/master/WordPress.xml
- "Preferences > Editor > Inspections > PHP > PHP Code Sniffer validation" にチェックを入れる
- "Preferences > Editor > Inspections > SQL > No data sources configured(データソースが構成させていません)" のチェックを外す
- "Preferences > Editor > Inspections > SQL > SQL dialect detection(SQL ダイアレクトの検出)" のチェックを外す
- Coding standard は WordPress core を選択
- "Preferences > Editor > Code Style > Scheme" で WordPress を選択
- "Preferences > Languages & Framework > PHP > WordPress > WordPress installation path" にパスを指定
- "Preferences > Languages & Framework > PHP > Composer" にパスを指定
- "Preferences > Tools > Command Line Tool Support" に WP-CLI と Composer を登録