diff --git a/phpstan.neon b/phpstan.neon index 5316d19e84e..9f4e8e2777d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -350,9 +350,3 @@ parameters: - identifier: argument.type 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#' - - - - path: rules/Renaming/Rector/Name/RenameClassRector.php - identifier: return.type - - - '#Method Rector\\(.*?)Rector\:\:refactor\(\) never returns \d so it can be removed from the return type#' diff --git a/src/Contract/Rector/RectorInterface.php b/src/Contract/Rector/RectorInterface.php index ec1b71f4233..d4c568c6cfe 100644 --- a/src/Contract/Rector/RectorInterface.php +++ b/src/Contract/Rector/RectorInterface.php @@ -5,7 +5,6 @@ namespace Rector\Contract\Rector; use PhpParser\Node; -use PhpParser\NodeTraverser; use PhpParser\NodeVisitor; use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface; @@ -21,7 +20,16 @@ public function getNodeTypes(): array; /** * Process Node of matched type - * @return Node|Node[]|null|NodeTraverser::* + * @return Node|Node[]|null|int + * + * For int return, choose: + * + * ✔️ To decorate current node and its children to not be traversed on current rule, return one of: + * - NodeVisitor::DONT_TRAVERSE_CHILDREN + * - NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN + * + * ✔️ To remove node of Node\Stmt or Node\Param, return: + * - NodeVisitor::REMOVE_NODE */ public function refactor(Node $node); }