Skip to content

Commit 3fabc95

Browse files
authored
Fix PHPStan @return unused type return.type on RectorInterface (#7406)
* Fix PHPStan @return unused type return.type on RectorInterface * Fix PHPStan @return unused type return.type on RectorInterface * add note * add note * add note
1 parent ab0c8b7 commit 3fabc95

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

phpstan.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,3 @@ parameters:
350350
-
351351
identifier: argument.type
352352
message: '#Parameter \#1 \$expr of method Rector\\CodeQuality\\Rector\\BooleanOr\\RepeatedOrEqualToInArrayRector\:\:matchComparedExprAndValueExpr\(\) expects PhpParser\\Node\\Expr\\BinaryOp\\Equal\|PhpParser\\Node\\Expr\\BinaryOp\\Identical, PhpParser\\Node\\Expr given#'
353-
354-
-
355-
path: rules/Renaming/Rector/Name/RenameClassRector.php
356-
identifier: return.type
357-
358-
- '#Method Rector\\(.*?)Rector\:\:refactor\(\) never returns \d so it can be removed from the return type#'

src/Contract/Rector/RectorInterface.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Rector\Contract\Rector;
66

77
use PhpParser\Node;
8-
use PhpParser\NodeTraverser;
98
use PhpParser\NodeVisitor;
109
use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
1110

@@ -21,7 +20,16 @@ public function getNodeTypes(): array;
2120

2221
/**
2322
* Process Node of matched type
24-
* @return Node|Node[]|null|NodeTraverser::*
23+
* @return Node|Node[]|null|int
24+
*
25+
* For int return, choose:
26+
*
27+
* ✔️ To decorate current node and its children to not be traversed on current rule, return one of:
28+
* - NodeVisitor::DONT_TRAVERSE_CHILDREN
29+
* - NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN
30+
*
31+
* ✔️ To remove node of Node\Stmt or Node\Param, return:
32+
* - NodeVisitor::REMOVE_NODE
2533
*/
2634
public function refactor(Node $node);
2735
}

0 commit comments

Comments
 (0)