Home >php教程 >php手册 >PHP_CodeSniffer 格式校验规则

PHP_CodeSniffer 格式校验规则

WBOY
WBOYOriginal
2016-06-06 20:13:401342browse

最近项目加上了校验规则,你懂的 phpcs 安装 phpcs pear install PHP_CodeSniffer 使用 phpcs --config-set encoding=utf-8 phpcs --config-set tab_width=4 phpcs --config-set show_warings=0 phpcs --config-show Array ( [encoding] = utf-8 [tab_width]

最近项目加上了校验规则,你懂的

phpcs

安装 phpcs

   pear install PHP_CodeSniffer

使用

 phpcs --config-set encoding=utf-8
 phpcs --config-set tab_width=4
 phpcs --config-set show_warings=0
 phpcs --config-show
 Array
 (
    [encoding] => utf-8
    [tab_width] => 4
    [show_warnings] => 0
 )
 phpcs -s *.php

由于项目中校验了 Doc comment,file comment ,我使用了

  DoxygenToolkit.vim

插件做function comment,但是对于 file comment,doc comment 来说DoxygenToolkit 并不满足我的项目

于是我花了一点时间用 python 写了一个小的 vim 插件,专门添加符合我需求的注释,

  commentvim.vim
 git hub 地址 : https://github.com/childeYin/vim-comment-plugin
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn