Debug PHP in vim and install PHP CODE_SNIFFER,PHP-MD. Phpqa.vim
1: Install PHP code sniffer and PHP MD
PHP Code Sniffer
of the A:centos department.
#yum Install Php-pear
#yum Install Imagemagick-devel
#pear Install Php_codesniffer
#pear Channel-discover pear.phpmd.org
#pear Channel-discover pear.pdepend.org
#pear Install--alldeps PHPMD/PHP_PMD
Modify php.ini file, join extension=imagick.so
of the Debian department.
#apt-get Install Php-pear
#apt-get Install Php5-imagick ImageMagick
Back and above CentOS,
Just do not need to modify php.ini to join the Imagick extension.
2:vim inside
:!php-l% This is the check the current PHP file syntax parameters
:p HPCs, this is code sniffer.
:p HPMD This is mess detector, need an XML rule file if not set
:p HPCC This shows the code coverage. Also need an XML rule file if not set
3: Install Phpqa.vim
Https://github.com/rainysia/vimrc/commits/master
To clone down, put in $~.vim inside, notice is user below. Vim
Add in. vimrc
Let G:phpqa_codesniffer_args = "--standard=zend" let g:phpqa_codesniffer_cmd = '/usr/bin/phpcs ' let G:phpqa_ Codesniffer_autorun = 1 " default =1 on Savelet g:phpqa_messdetector_ruleset = ' let G:phpqa_messdetector_cmd = ' /USR/BIN/PHPMD ' Let G:phpqa_messdetector_autorun = 0
Where CMD these two are the first steps above the type out of the path after installation,
#type Phpcs
/usr/bin/phpcs
Autorun = 1 is automatically turned on, when you save it will automatically run the prompt
Sebastian Bergmann ' s ruleset
Now do the next test, open the VIM input and then: w save, prompt error, said PHP can not be closed. It seems that the grammar requirements are very strict. Remove the?> and save it without error.
Specific can be used in the shell-H view
Reference URL
http://phpmd.org/download/index.html installation PHPMD
http://pear.php.net/package/PHP_CodeSniffer/redirected PHP Code Sniffer
http://blog.csdn.net/xinhaozheng/article/details/3324796 Use of PHP code sniffer
Http://developer.51cto.com/art/201105/261292.htm the use of PHP mess Detor
http://coreymaynard.com/blog/finding-what-stinks-and-cleaning-up-the-mess/Related XML declarations
http://joncairns.com/2012/05/using-vim-as-a-php-ide/#comment -133 Phpqa Articles
Https://github.com/joonty/vim-phpqa is still phpqa.