LoginSignup
4
4

More than 5 years have passed since last update.

vim: PHP PSR-2 チェック

Posted at

neobundle でsyntasticをバンドルする

$ vi ~/bin/home/.vimrc.neobundle 


NeoBundle 'scrooloose/syntastic'
$ grep neo ~/.vimrc 
source ~/bin/home/.vimrc.neobundle

バンドル

$ vim

Not installed bundles:  ['syntastic']
Install bundles now?
(y)es, [N]o: y

[neobundle/install] Update started: (2014/11/12 10:30:52)
(1/1) [====================] syntastic
[neobundle/install] (1/1): |syntastic| Updated
[neobundle/install] |syntastic|  -> de5e025ef0b8a9eec588d618ebaebd104945af4c
[neobundle/install] Installed/Updated bundles:
syntastic
[neobundle/install] Update done: (2014/11/12 10:31:02)
続けるにはENTERを押すかコマンドを入力してください

PHP_CodeSniffer 設定

PEARでインストール

$ sudo pear install PHP_CodeSniffer
Unknown remote channel: pear.phpunit.de
Did not download optional dependencies: channel://pear.phpunit.de/PHP_Timer, use --alldeps to download automatically
pear/PHP_CodeSniffer can optionally use package "channel://pear.phpunit.de/PHP_Timer"
downloading PHP_CodeSniffer-1.5.5.tgz ...
Starting to download PHP_CodeSniffer-1.5.5.tgz (412,025 bytes)
.........................................done: 412,025 bytes
install ok: channel://pear.php.net/PHP_CodeSniffer-1.5.5
$ phpcs --version
PHP_CodeSniffer version 1.5.5 (stable) by Squiz (http://www.squiz.net)
$ phpcs -i 
The installed coding standards are MySource, PEAR, Squiz, PHPCS, PSR2, Zend and PSR1

.vimrc


$ vim ~/.vimrc

" -- for PHP syntastic  -----------------------
let g:syntastic_mode_map = {
  \ 'mode': 'active',
  \ 'active_filetypes': ['php']
  \}
let g:syntastic_auto_loc_list = 1
let g:syntastic_php_checkers = ['phpcs']
let g:syntastic_php_phpcs_args='--standard=psr2'
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4