PHPCompatibility检测php版本语法兼容
Posted andyChan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHPCompatibility检测php版本语法兼容相关的知识,希望对你有一定的参考价值。
直接上步骤:
1 cd /datas/htdocs/ 2 mkdir phpCompatibility 3 cd PHPCompatibility/ 4 curl -s http://getcomposer.org/installer | php 5 ./composer.phar require "squizlabs/php_codesniffer=2.*" 6 cd vendor/squizlabs/php_codesniffer/CodeSniffer/Standards 7 git clone https://github.com/wimg/PHPCompatibility.git 8 cd /datas/htdocs/PHPCompatibility/ 9 ./vendor/bin/phpcs -i 10 ./vendor/bin/phpcs --standard=PHPCompatibility --runtime-set testVersion 7.1 /datas/htdocs/thinkphp/
上面第10行是那thinkphp做测试,结果类似:
1 FILE: ...s/htdocs/thinkphp/Library/Vendor/TemplateLite/class.compiler.php 2 ---------------------------------------------------------------------- 3 FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES 4 ---------------------------------------------------------------------- 5 159 | ERROR | preg_replace() - /e modifier is deprecated since PHP 6 | | 5.5 and removed since PHP 7.0 7 ----------------------------------------------------------------------
更多PHPCompatibility相关内容,请参考 https://www.sitepoint.com/quick-intro-phpcompatibility-standard-for-phpcs-are-you-php7-ready/
以上是关于PHPCompatibility检测php版本语法兼容的主要内容,如果未能解决你的问题,请参考以下文章