==================================
1. 代码规范审查以及修正工具 - PHP_CodeSniffer
- 简短说明
PHP_CodeSniffer is a set of two PHP scripts; the main phpcs script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second phpcbf script to automatically correct coding standard violations. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
- 工具地址
https://github.com/squizlabs/PHP_CodeSniffer - 项目具体使用说明
检测
phpcs --standard=PSR2 ./,遵循psr2代码规范。 规范详细内容请看这里:http://www.php-fig.org/psr/psr-2/
修复
phpcbf --standard=PSR2 *
网友评论