mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-23 11:14:38 +01:00
show applied Rectors even on adding/removing nodes
This commit is contained in:
parent
b390f1b887
commit
7682a10dd9
@ -67,11 +67,20 @@ abstract class AbstractRector extends NodeVisitorAbstract implements PhpRectorIn
|
||||
*/
|
||||
public function afterTraverse(array $nodes): array
|
||||
{
|
||||
$nodes = $this->nodeAddingCommander->traverseNodes($nodes);
|
||||
// @todo foreach, array autowire on Required in CommanderInterface[]
|
||||
if ($this->nodeAddingCommander->isActive()) {
|
||||
$nodes = $this->nodeAddingCommander->traverseNodes($nodes);
|
||||
}
|
||||
|
||||
$nodes = $this->propertyAddingCommander->traverseNodes($nodes);
|
||||
if ($this->propertyAddingCommander->isActive()) {
|
||||
$nodes = $this->propertyAddingCommander->traverseNodes($nodes);
|
||||
}
|
||||
|
||||
return $this->nodeRemovingCommander->traverseNodes($nodes);
|
||||
if ($this->nodeRemovingCommander->isActive()) {
|
||||
$nodes = $this->nodeRemovingCommander->traverseNodes($nodes);
|
||||
}
|
||||
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
private function isMatchingNodeType(string $nodeClass): bool
|
||||
|
@ -39,11 +39,15 @@ trait NodeAddingTrait
|
||||
protected function addNodeAfterNode(Expr $node, Node $positionNode): void
|
||||
{
|
||||
$this->nodeAddingCommander->addNodeAfterNode($node, $positionNode);
|
||||
|
||||
$this->appliedRectorCollector->addRectorClass(static::class);
|
||||
}
|
||||
|
||||
protected function addPropertyToClass(Class_ $classNode, string $propertyType, string $propertyName): void
|
||||
{
|
||||
$variableInfo = new VariableInfo($propertyName, $propertyType);
|
||||
$this->propertyAddingCommander->addPropertyToClass($variableInfo, $classNode);
|
||||
|
||||
$this->appliedRectorCollector->addRectorClass(static::class);
|
||||
}
|
||||
}
|
||||
|
@ -27,5 +27,8 @@ trait NodeRemovingTrait
|
||||
protected function removeNode(Node $node): void
|
||||
{
|
||||
$this->nodeRemovingCommander->addNode($node);
|
||||
|
||||
$this->appliedRectorCollector->addRectorClass(static::class);
|
||||
}
|
||||
}
|
||||
q
|
Loading…
x
Reference in New Issue
Block a user