saschaegerer / arc-phpstan
0.3.4
2019-07-18 15:23 UTC
Requires
- phpstan/phpstan: ^0.9 || ^0.10 || ^0.11
This package is auto-updated.
Last update: 2024-09-01 02:50:39 UTC
README
基于 material-foundation/arc-tslint 和在 sascha-egerer/arc-phpstan 中的一些改进。为 arc lint
提供了对 phpstan
的基本支持。
arc-phpstan
使用 phpstan 和 Phabricator 的 arc
命令行工具对您的 PHP 源代码进行代码检查。
特性
phpstan 生成警告信息。
示例输出
>>> Lint for src/AppBundle/Foo.php:
Error () phpstan violation
Error: AppBundle\Foo::__construct() does not
call parent constructor from AppBundle\Bar.
33 * constructor
34 */
>>> 35 public function __construct()
36 {
37 Bar::__construct();
38 $this->property = 0;
安装
需要 phpstan。您可以按照官方说明进行安装并将其添加到您的 $PATH 中,或者您可以运行 composer install
,并将 bin
选项指向 vendor/bin/phpstan
,如下面的示例所示。
项目特定安装
您可以将此存储库作为 git 子模块添加。在您的 .arcconfig
中添加子模块的路径,如下所示
{ "load": ["path/to/arc-phpstan"] }
全局安装
arcanist
可以从绝对路径加载模块。但是,它也会在自身所在目录的上一级目录中搜索模块。
您可以将此存储库克隆到与 arcanist
和 libphutil
相同的目录中。最后它看起来像这样
arcanist/ arc-phpstan/ libphutil/
您的 .arcconfig
可能如下所示
{ "load": ["arc-phpstan"] }
设置
要使用检查器,您必须在您的 .arclint
文件中注册它,如下面的示例所示
{ "linters": { "phpstan": { "type": "phpstan", "include": "(\\.php$)", "config": "var/build/phpstan.neon", /* optional */ "bin": "vendor/bin/phpstan", /* optional */ "level": "0" /* optional */ } } }
许可证
在 Apache 2.0 许可证下发布。有关详细信息,请参阅 LICENSE。