PHP Compatibility Coding Standard for PHP_CodeSniffer

https://github.com/wimg/PHPCompatibility

系统要求

  • PHP 5.3 或以上
  • PHPCS 2.6 或以上
  • PHPCompatibility standard 当前不支持 PHPCS 3.0 版本

安装教程

安装 PHPCS

1
2
3
4
5
6
7
8
9
10
11
12
13
14

cd ~/.composer/vendor/

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

export PATH=~/.composer/vendor/bin:$PATH

cd ~/.composer/vendor/squizlabs/php_codesniffer/

# download the PHP_CodeSniffer source and run the phpcs and phpcbf commands directly from the Git clone

php bin/phpcs -h

php bin/phpcbf -h

安装 PHPCompatibility 标准

1
2
3
4
5
6
7
8
9
10
cd ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards

git clone https://github.com/wimg/PHPCompatibility.git

phpcs -n \
--standard=PHPCompatibility \
--extensions=php \
--runtime-set testVersion 7.0 \
--report-full=~/test-7.0.log \
/home/wwwroot/default/test/
坚持原创技术分享,您的支持将鼓励我继续创作!