From 42c64b9bc10870a87e63793fee2d6393fa94234d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mor=C3=A1vek?= Date: Sun, 23 Oct 2022 20:20:39 +0200 Subject: [PATCH] Enable new shipmonk phpstan rules --- composer.json | 2 +- phpstan.tests.neon.dist | 4 ++++ tests/PHPStan/shipmonk.neon | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 44c06f8..0919a02 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "phpstan/phpstan-strict-rules": "1.4.4", "nepada/phpstan-nette-tester": "1.0.0", "spaze/phpstan-disallowed-calls": "2.5.0", - "shipmonk/phpstan-rules": "1.1.1", + "shipmonk/phpstan-rules": "1.2.0", "php-parallel-lint/php-parallel-lint": "1.3.2", "nepada/coding-standard": "7.5.2" }, diff --git a/phpstan.tests.neon.dist b/phpstan.tests.neon.dist index 1719bdd..2882bf3 100644 --- a/phpstan.tests.neon.dist +++ b/phpstan.tests.neon.dist @@ -35,3 +35,7 @@ parameters: message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(array\\\\|Symfony\\\\Component\\\\Messenger\\\\Stamp\\\\StampInterface\\)\\: mixed\\)\\|null, Closure\\(Symfony\\\\Component\\\\Messenger\\\\Stamp\\\\HandledStamp\\)\\: string given\\.$#" count: 1 path: tests/MessageBus/Middleware/LoggingMiddlewareTest.phpt + - # false positive + message: "#^Invalid var phpdoc of \\$handledStamps\\. Cannot assign array\\\\|Symfony\\\\Component\\\\Messenger\\\\Stamp\\\\StampInterface\\> to array\\$#" + count: 1 + path: tests/MessageBus/Middleware/PreventNestedHandlingMiddlewareTest.phpt diff --git a/tests/PHPStan/shipmonk.neon b/tests/PHPStan/shipmonk.neon index 6df72ae..0678b89 100644 --- a/tests/PHPStan/shipmonk.neon +++ b/tests/PHPStan/shipmonk.neon @@ -1,10 +1,15 @@ rules: + - ShipMonk\PHPStan\Rule\BackedEnumGenericsRule + - ShipMonk\PHPStan\Rule\ForbidAssignmentNotMatchingVarDocRule + - ShipMonk\PHPStan\Rule\ForbidEnumInFunctionArgumentsRule - ShipMonk\PHPStan\Rule\ForbidFetchOnMixedRule - ShipMonk\PHPStan\Rule\ForbidMatchDefaultArmForEnumsRule - ShipMonk\PHPStan\Rule\ForbidMethodCallOnMixedRule - ShipMonk\PHPStan\Rule\ForbidReturnInConstructorRule - ShipMonk\PHPStan\Rule\ForbidUnsetClassFieldRule - ShipMonk\PHPStan\Rule\ForbidUnusedExceptionRule + - ShipMonk\PHPStan\Rule\ForbidUnusedMatchResultRule + - ShipMonk\PHPStan\Rule\ForbidVariableTypeOverwritingRule - ShipMonk\PHPStan\Rule\RequirePreviousExceptionPassRule services: @@ -12,3 +17,7 @@ services: type: ShipMonk\PHPStan\Visitor\UnusedExceptionVisitor tags: - phpstan.parser.richParserNodeVisitor + - + class: ShipMonk\PHPStan\Visitor\UnusedMatchVisitor + tags: + - phpstan.parser.richParserNodeVisitor