Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rules/CodeQuality/Rector/FuncCall/SetTypeToCastRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function getNodeTypes(): array

/**
* @param FuncCall|Expression|Assign|ArrayItem|Node\Arg $node
* @return null|NodeVisitor::DONT_TRAVERSE_CHILDREN|Expression|Assign|Cast
*/
public function refactor(Node $node): null|int|Expression|Assign|Cast
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function getNodeTypes(): array

/**
* @param String_|FuncCall|ClassConst $node
* @return Concat|ClassConstFetch|null|NodeVisitor::DONT_TRAVERSE_CHILDREN
*/
public function refactor(Node $node): Concat|ClassConstFetch|null|int
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function getNodeTypes(): array

/**
* @param Switch_|Break_ $node
* @return Return_|null|NodeVisitor::REMOVE_NODE
*/
public function refactor(Node $node): Return_|null|int
{
Expand Down
1 change: 1 addition & 0 deletions rules/Php72/Rector/Unset_/UnsetCastRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function getNodeTypes(): array

/**
* @param Unset_|Assign|Expression $node
* @return NodeVisitor::REMOVE_NODE|Node|null
*/
public function refactor(Node $node): int|null|Node
{
Expand Down
1 change: 1 addition & 0 deletions rules/Php81/Rector/Array_/FirstClassCallableRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function getNodeTypes(): array

/**
* @param Property|ClassConst|Array_ $node
* @return StaticCall|MethodCall|null|NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN
*/
public function refactor(Node $node): int|null|StaticCall|MethodCall
{
Expand Down
2 changes: 2 additions & 0 deletions rules/Renaming/Rector/Name/RenameClassRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function getNodeTypes(): array

/**
* @param ClassConstFetch|FunctionLike|FullyQualified|Name|ClassLike|Expression|Property|If_ $node
* @return null|NodeVisitor::DONT_TRAVERSE_CHILDREN|Node
*/
public function refactor(Node $node): int|null|Node
{
Expand Down Expand Up @@ -125,6 +126,7 @@ public function configure(array $configuration): void

/**
* @param array<string, string> $oldToNewClasses
* @return null|NodeVisitor::DONT_TRAVERSE_CHILDREN
*/
private function processClassConstFetch(ClassConstFetch $classConstFetch, array $oldToNewClasses): int|null
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function getNodeTypes(): array

/**
* @param StmtsAwareInterface $node
* @return null|Node|NodeVisitor::DONT_TRAVERSE_CHILDREN
*/
public function refactor(Node $node): null|Node|int
{
Expand Down
11 changes: 1 addition & 10 deletions src/Contract/Rector/RectorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@ public function getNodeTypes(): array;

/**
* Process Node of matched type
* @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
* @return Node|Node[]|null|NodeVisitor::*
*/
public function refactor(Node $node);
}
2 changes: 1 addition & 1 deletion src/Rector/AbstractRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ final public function enterNode(Node $node): int|Node|null
}

if ($isIntRefactoredNode) {
// @see NodeTraverser::* codes, e.g. removal of node of stopping the traversing
// @see NodeVisitor::* codes, e.g. removal of node of stopping the traversing
if ($refactoredNode === NodeVisitor::REMOVE_NODE) {
// log here, so we can remove the node in leaveNode() method
$this->toBeRemovedNodeId = spl_object_id($originalNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function getNodeTypes(): array

/**
* @param Assign|MethodCall $node
* @return Assign|int|null|NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN
*/
public function refactor(Node $node): Assign|null|int
{
Expand Down