phpStorm怎么配置PHP_CodeSniffer自动检查代码

phpStorm怎么配置PHP_CodeSniffer自动检查代码

环境 ubuntu18.4 phpstorm php7.2

最正确安装方法                                      (推荐学习:phpstorm

sudo apt-get install php-codesniffer

composer安装PHP_CodeSniffer   

composer global require "squizlabs/php_codesniffer=*" //这个方法装好后各种问题

配置phpstorm

立即学习PHP免费学习笔记(深入)”;

找到phpcs文件并记住

jiang@jiang:/usr/local$ cd /home/jiang/.config/composer/vendor/bin/jiang@jiang:~/.config/composer/vendor/bin$ ls phpcbf  phpcs

 将执行路径加入环境变量vim ~/.bashrc

export PHPCODESNIFFER=/home/jiang/.composer/vendor;  export PATH=$JAVA_HOME/usr/local/eclipse:$ECLIPSE_HOME:$MAVEN_HOME/bin:$TOMCAT_HOME/bin:$TOMCAT_HOME/bin:$PHPCODESNIFFER/bin:$PATH:

选择 File->Setting->Languages & Frameworks->PHP->Quality Tools-> Code Sniffer 并按如下配置 

phpStorm怎么配置PHP_CodeSniffer自动检查代码选择 File->Setting->Editor->Inspections->Quality Tools->勾选PHP Code Sniffer Validation 选择右侧的PSR2

phpStorm怎么配置PHP_CodeSniffer自动检查代码点击验证

phpStorm怎么配置PHP_CodeSniffer自动检查代码

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享