airlst / phpstan-config
AirLST项目PHPStan配置
9.0.2
2024-09-23 13:02 UTC
Requires
- php: ^8.3
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: 1.12.4
- phpstan/phpstan-deprecation-rules: 1.2.1
- phpstan/phpstan-strict-rules: 1.6.1
- rector/type-perfect: 0.2.0
- spaze/phpstan-disallowed-calls: 3.4.0
- tomasvotruba/type-coverage: 0.3.1
Requires (Dev)
- airlst/php-cs-fixer-config: ^2.6.0
- airlst/rector-config: ^4.3.8
- ergebnis/composer-normalize: ^2.43.0
- dev-master
- 9.0.2
- 9.0.1
- 9.0.0
- 8.1.1
- 8.1.0
- 8.0.1
- 8.0.0
- 7.0.0
- 6.1.0
- 6.0.0
- 5.0.0
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.0
- 3.1.0
- 3.0.0
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.2
- 2.0.1
- 2.0.0
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.1
- 1.0.0
- dev-disallow-mutable-datetime
- dev-unused-public
- dev-strict-rules
This package is auto-updated.
Last update: 2024-09-23 13:02:53 UTC
README
AirLST项目PHPStan配置。
安装
您可以通过Composer安装此包
composer require --dev airlst/phpstan-config
请确保在您的composer.json
中允许运行phpstan/extension-installer
插件
{ "config": { "allow-plugins": { "phpstan/extension-installer": true } } }
使用
在项目根目录创建一个phpstan.php
文件,内容如下
<?php declare(strict_types=1); $factory = new Airlst\PhpstanConfig\Factory(['src']); return $factory ->level(8) ->create();
Factory
类的构造函数接受一个数组,包含要扫描的PHP文件路径,用于分析。您可以传递任意数量的路径给它。
配置
您可以在调用create()
之前,通过链式调用以下配置选项在Factory
类上使用
level(int $level)
: 设置PHPStan的级别include(string $file)
: 包含额外的PHPStan neon文件exclude(string $file)
: 排除提供的PHPStan neon文件withBleedingEdge()
: 使用前沿版本的PHPStanuseCacheDir(string $cacheDir)
: 使用PHPStan的缓存目录typeCoverage(int $return, int $param, int $property, int $constant)
: 设置类型覆盖率百分比,默认为所有100%typePerfect(bool $nullOverFalse, bool $noMixedProperty, bool $noMixedCaller, bool $narrowParam, bool $narrowReturn)
: 设置类型完美配置,默认全部开启。更多详细信息请参阅rectorphp/type-perfect README。addRule(string $file)
: 向PHPStan添加额外规则ignoreError(string $message, ?string $path, ?int $count, ?bool $reportUnmatched)
: 忽略提供的错误消息checkMissingIterableValueType(bool $enable = true)
: 启用/禁用checkMissingIterableValueType
规则checkGenericClassInNonGenericObjectType(bool $enable = true)
: 启用/禁用checkGenericClassInNonGenericObjectType
规则strictRules()
: 启用/禁用严格规则。有关可用方法参数的信息,请参阅phpstan/phpstan-strict-rules
文档
运行PHPStan
使用以下命令运行PHPStan
./vendor/bin/phpstan analyse -c phpstan.php
变更日志
请参阅CHANGELOG以获取有关最近更改的更多信息。
贡献
请参阅CONTRIBUTING以获取详细信息。
许可协议
MIT许可协议(MIT)。有关更多信息,请参阅许可文件。