PhpCodeAnalyzer
version` option
phpcodeanmalyzer在PHP代码中发现了不同非构建扩展的用法。此工具可帮助您了解PHP安装之间的代码如何运输。
要扫描您的文件或文件夹启动phpca并传递文件或目录名称。
> phpca .. H ttpServer
Scanning .. H ttpServer ...
[spl] Function " spl_autoload_register " used in file .. H ttpServer/vendor/composer/ClassLoader.php[258]
[spl] Function " spl_autoload_unregister " used in file .. H ttpServer/vendor/composer/ClassLoader.php[266]
[spl] Function " spl_autoload_register " used in file .. H ttpServer/vendor/composer/autoload_real.php[22]
[spl] Function " spl_autoload_unregister " used in file .. H ttpServer/vendor/composer/autoload_real.php[24]
Used non-built-in extensions in your code:
- [spl] Standard PHP Library (SPL). This extension is bundled with php since PHP 5.0.0. Extension is available in pecl: spl.您可以跳过--no-progress选项:
> phpca --no-progress .. y ii-1.1.16.bca042 f ramework c aching
Scanning .. y ii-1.1.16.bca042 f ramework c aching ...
Used non-built-in extensions in your code:
- [apc] Alternative PHP Cache. Extension is available in pecl: apc.
- [wincache] Windows Cache for PHP. Extension is available in pecl: wincache.
另外,您只能通过--no-report选项来保持进度:
> phpca --no-report .. y ii-1.1.16.bca042 f ramework c aching
Scanning .. y ii-1.1.16.bca042 f ramework c aching ...
[apc] Function " apc_fetch " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[46]
[apc] Function " apc_fetch " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[56]
[apc] Function " apc_store " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[70]
[apc] Function " apc_add " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[84]
[apc] Function " apc_delete " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[95]
[apc] Function " apc_clear_cache " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[107]
[apc] Function " apc_clear_cache " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[109]
[wincache] Function " wincache_ucache_get " used in file .. y ii-1.1.16.bca042 f ramework c aching/CWinCache.php[46]
[wincache] Function " wincache_ucache_get " used in file .. y ii-1.1.16.bca042 f ramework c aching/CWinCache.php[56]
[wincache] Function " wincache_ucache_set " used in file .. y ii-1.1.16.bca042 f ramework c aching/CWinCache.php[70]
[wincache] Function " wincache_ucache_add " used in file .. y ii-1.1.16.bca042 f ramework c aching/CWinCache.php[84]
[wincache] Function " wincache_ucache_delete " used in file .. y ii-1.1.16.bca042 f ramework c aching/CWinCache.php[95]
[wincache] Function " wincache_ucache_clear " used in file .. y ii-1.1.16.bca042 f ramework c aching/CWinCache.php[106]如果您只想查看一个特定扩展名的用法,请使用--extension=选项:
> phpca --extension=apc .. y ii-1.1.16.bca042 f ramework c aching
Scanning .. y ii-1.1.16.bca042 f ramework c aching ...
[apc] Function " apc_fetch " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[46]
[apc] Function " apc_fetch " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[56]
[apc] Function " apc_store " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[70]
[apc] Function " apc_add " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[84]
[apc] Function " apc_delete " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[95]
[apc] Function " apc_clear_cache " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[107]
[apc] Function " apc_clear_cache " used in file .. y ii-1.1.16.bca042 f ramework c aching/CApcCache.php[109]最终不会在这种情况下添加摘要报告。
可用选项的完整列表:
> phpca -h
PhpCodeAnalyzer
Usage:
phpca [-v] [-q] [--output =< path > ] [--no-report] [--no-progress] [--since-version =< version > ] FILES...
phpca [-v] [-q] [--output =< path > ] --extension= < ext > FILES...
phpca -h
Options:
-h --help Show this text
-v --verbose Show more debug text
-q --quiet Don ' t print any messages
--output=<path> Path where to generate XML report
--extension=<ext> Look for usage a specific extension
--no-report Turn off summary report
--no-progress Turn off progress
--since-version=<version> Only include extensions not included since versionchmod +x phpca.phar一个。本地安装:从当前文件夹中使用它:
. /phpca.phar -h b。全局安装:将其输入到您的$PATH中列出的一个文件夹中,然后从任何文件夹中运行:
sudo mv phpca.phar /usr/local/bin/phpca
phpca -h安装PHPCA的另一种方法是通过作曲家。
curl -sS https://getcomposer.org/installer | php./composer.phar global require wapmorgan/php-code-analyzer dev-masterphpca -h