diff --git a/composer.json b/composer.json index 2ba401a..a474b30 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,8 @@ "hyperf/devtool": "3.2.*", "hyperf/testing": "3.2.*", "mockery/mockery": "^1.0", - "phpstan/phpstan": "^1.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", "swoole/ide-helper": "dev-master" }, "autoload": { @@ -73,7 +74,7 @@ "optimize-autoloader": true, "sort-packages": true }, - "extra": [], + "extra": {}, "scripts": { "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" @@ -81,7 +82,7 @@ "post-autoload-dump": [ "rm -rf runtime/container" ], - "analyse": "phpstan analyse --memory-limit 512M", + "analyse": "phpstan analyse --memory-limit 1G", "cs-fix": "php-cs-fixer fix $1", "start": "php ./bin/hyperf.php start", "test": "co-phpunit --prepend test/bootstrap.php --colors=always", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c28cea5..358baf4 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -4,8 +4,10 @@ # vendor/bin/phpstan analyse app --memory-limit 200M -l 0 # includes: + - vendor/phpstan/phpstan-strict-rules/rules.neon # 需要执行 composer require phpstan/phpstan-deprecation-rules --dev # - vendor/phpstan/phpstan-deprecation-rules/rules.neon + parameters: level: 0 paths: @@ -24,9 +26,6 @@ services: # When using `match` to match enum, the enumeration must be completely overwritten - class: PHPStan\Rules\Comparison\MatchExpressionRule arguments: - checkAlwaysTrueStrictComparison: %checkAlwaysTrueStrictComparison% - disableUnreachable: %featureToggles.disableUnreachableBranchesRules% - reportAlwaysTrueInLastCondition: %reportAlwaysTrueInLastCondition% treatPhpDocTypesAsCertain: %treatPhpDocTypesAsCertain% tags: - - phpstan.rules.rule + - phpstan.rules.rule \ No newline at end of file