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
7 changes: 6 additions & 1 deletion src/Contract/Rector/RectorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PhpParser\NodeVisitor;
use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;

interface RectorInterface extends NodeVisitor, DocumentedRuleInterface
interface RectorInterface extends DocumentedRuleInterface
{
/**
* List of nodes this class checks, classes that implements \PhpParser\Node
Expand All @@ -18,6 +18,11 @@ interface RectorInterface extends NodeVisitor, DocumentedRuleInterface
*/
public function getNodeTypes(): array;

/**
* @return int|Node|Node[]|null
*/
public function enterNode(Node $node): int|Node|array|null;

/**
* Process Node of matched type
* @return Node|Node[]|null|NodeVisitor::REMOVE_NODE
Expand Down
30 changes: 1 addition & 29 deletions src/Rector/AbstractRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Rector\Rector;

use Deprecated;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
Expand All @@ -17,7 +16,6 @@
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitor;
use PhpParser\NodeVisitor\CloningVisitor;
use PhpParser\NodeVisitorAbstract;
use PHPStan\Analyser\MutatingScope;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
Expand All @@ -40,7 +38,7 @@
use Rector\Skipper\ValueObject\SkipMatch;
use Rector\ValueObject\Application\File;

abstract class AbstractRector extends NodeVisitorAbstract implements RectorInterface
abstract class AbstractRector implements RectorInterface
{
private const string EMPTY_NODE_ARRAY_MESSAGE = <<<CODE_SAMPLE
Array of nodes cannot be empty. Ensure "%s->refactor()" returns non-empty array for Nodes.
Expand Down Expand Up @@ -103,26 +101,6 @@ public function autowire(
$this->commentsMerger = $commentsMerger;
}

/**
* @return Node[]|null
*
* @internal
*/
final public function beforeTraverse(array $nodes): ?array
{
return null;
}

/**
* @return Node[]|null
*
* @internal
*/
final public function afterTraverse(array $nodes)
{
return null;
}

/**
* @return NodeVisitor::REMOVE_NODE|Node|null|Node[]
*/
Expand Down Expand Up @@ -190,12 +168,6 @@ final public function enterNode(Node $node): int|Node|null|array
return $this->postRefactorProcess($originalNode, $node, $refactoredNodeOrState, $filePath);
}

#[Deprecated(message: 'no longer used')]
final public function leaveNode(Node $node): array|int|Node|null
{
return null;
}

protected function getFile(): File
{
$file = $this->currentFileProvider->getFile();
Expand Down
Loading