From 969e6fa31d5484d42dab902703cfc6820a983cfd Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Sat, 20 May 2023 18:17:43 +0200 Subject: [PATCH] Bleeding edge - require rules to return `list` --- conf/bleedingEdge.neon | 2 ++ phpstan-baseline.neon | 25 +++++++++++++++++++++++++ stubs/bleedingEdge/Rule.stub | 26 ++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 stubs/bleedingEdge/Rule.stub diff --git a/conf/bleedingEdge.neon b/conf/bleedingEdge.neon index 6f9c5d35b..bb5878f40 100644 --- a/conf/bleedingEdge.neon +++ b/conf/bleedingEdge.neon @@ -39,3 +39,5 @@ parameters: stricterFunctionMap: true invalidPhpDocTagLine: true detectDeadTypeInMultiCatch: true + stubFiles: + - ../stubs/bleedingEdge/Rule.stub diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ff7817b66..409c9d06b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -440,6 +440,16 @@ parameters: count: 1 path: src/Rules/Api/NodeConnectingVisitorAttributesRule.php + - + message: "#^Method PHPStan\\\\Rules\\\\Arrays\\\\AppendedArrayItemTypeRule\\:\\:processNode\\(\\) should return list\\ but returns array\\{PHPStan\\\\Rules\\\\TipRuleError\\}\\.$#" + count: 1 + path: src/Rules/Arrays/AppendedArrayItemTypeRule.php + + - + message: "#^Method PHPStan\\\\Rules\\\\Arrays\\\\AppendedArrayKeyTypeRule\\:\\:processNode\\(\\) should return list\\ but returns array\\{PHPStan\\\\Rules\\\\RuleError\\}\\.$#" + count: 1 + path: src/Rules/Arrays/AppendedArrayKeyTypeRule.php + - message: "#^Doing instanceof PHPStan\\\\Type\\\\ConstantScalarType is error\\-prone and deprecated\\. Use Type\\:\\:isConstantScalarValue\\(\\) or Type\\:\\:getConstantScalarTypes\\(\\) or Type\\:\\:getConstantScalarValues\\(\\) instead\\.$#" count: 1 @@ -518,6 +528,11 @@ parameters: count: 4 path: src/Rules/Comparison/MatchExpressionRule.php + - + message: "#^Method PHPStan\\\\Rules\\\\Comparison\\\\MatchExpressionRule\\:\\:processNode\\(\\) should return list\\ but returns list\\\\.$#" + count: 1 + path: src/Rules/Comparison/MatchExpressionRule.php + - message: "#^Doing instanceof PHPStan\\\\Type\\\\Constant\\\\ConstantBooleanType is error\\-prone and deprecated\\. Use Type\\:\\:isTrue\\(\\) or Type\\:\\:isFalse\\(\\) instead\\.$#" count: 2 @@ -538,11 +553,21 @@ parameters: count: 1 path: src/Rules/Comparison/UnreachableIfBranchesRule.php + - + message: "#^Method PHPStan\\\\Rules\\\\Comparison\\\\UnreachableIfBranchesRule\\:\\:processNode\\(\\) should return list\\ but returns list\\\\.$#" + count: 1 + path: src/Rules/Comparison/UnreachableIfBranchesRule.php + - message: "#^Doing instanceof PHPStan\\\\Type\\\\Constant\\\\ConstantBooleanType is error\\-prone and deprecated\\. Use Type\\:\\:isTrue\\(\\) or Type\\:\\:isFalse\\(\\) instead\\.$#" count: 1 path: src/Rules/Comparison/UnreachableTernaryElseBranchRule.php + - + message: "#^Method PHPStan\\\\Rules\\\\Comparison\\\\UnreachableTernaryElseBranchRule\\:\\:processNode\\(\\) should return list\\ but returns array\\{PHPStan\\\\Rules\\\\LineRuleError\\}\\.$#" + count: 1 + path: src/Rules/Comparison/UnreachableTernaryElseBranchRule.php + - message: "#^Doing instanceof PHPStan\\\\Type\\\\Constant\\\\ConstantBooleanType is error\\-prone and deprecated\\. Use Type\\:\\:isTrue\\(\\) or Type\\:\\:isFalse\\(\\) instead\\.$#" count: 1 diff --git a/stubs/bleedingEdge/Rule.stub b/stubs/bleedingEdge/Rule.stub new file mode 100644 index 000000000..0a86ea9d2 --- /dev/null +++ b/stubs/bleedingEdge/Rule.stub @@ -0,0 +1,26 @@ + + */ + public function getNodeType(): string; + + /** + * @phpstan-param TNodeType $node + * @return list + */ + public function processNode(Node $node, Scope $scope): array; + +}