码迷,mamicode.com
首页 > Web开发 > 详细

PhpStorm添加PHP代码规范检查CodeSniffer(phpcs)和PHP代码静态分析工具Mess Detector(phpmd)

时间:2017-07-12 21:35:18      阅读:1168      评论:0      收藏:0      [点我收藏+]

标签:code   bat   cti   规范   storm   点击   .com   local   data   

一、安装

添加镜像,加速下载

./composer.phar  config -g repo.packagist composer https://packagist.phpcomposer.com

CodeSniffer

composer.phar global require "squizlabs/php_codesniffer=*"

Mess Detector

composer.phar global require "phpmd/phpmd=*"

二、PhpStorm配置phpcs, phpmd位置

 File -> Default Setting -> Language & Frameworks -> Code Sniffer -> Config[Local] 点击 ... 按钮 -> path: C:\Users\{username}\AppData\Roaming\Composer\vendor\bin\phpcs.bat

 File -> Default Setting -> Language & Frameworks -> Mess Detector -> Config[Local] 点击 ... 按钮 -> path: C:\Users\{username}\AppData\Roaming\Composer\vendor\bin\phpmd.bat

 三、PhpStorm启用phpcs, phpmd

File -> Default Setting -> Editor -> Inspections -> PHP -> PHP Code Sniffer validation (打上勾)-> Coding standard -> PSR2 -> Apply

File -> Default Setting -> Editor -> Inspections -> PHP -> PHP Mess Detector validation (打上勾)-> Options(选择相应规则) -> Apply

 

PhpStorm添加PHP代码规范检查CodeSniffer(phpcs)和PHP代码静态分析工具Mess Detector(phpmd)

标签:code   bat   cti   规范   storm   点击   .com   local   data   

原文地址:http://www.cnblogs.com/imbin/p/7157244.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!