class CloningVisitor
Same name in this branch
- 11.1.x vendor/phpstan/phpdoc-parser/src/Ast/NodeVisitor/CloningVisitor.php \PHPStan\PhpDocParser\Ast\NodeVisitor\CloningVisitor
Visitor cloning all nodes and linking to the original nodes using an attribute.
This visitor is required to perform format-preserving pretty prints.
Hierarchy
- class \PhpParser\NodeVisitorAbstract implements \PhpParser\NodeVisitor
- class \PhpParser\NodeVisitor\CloningVisitor extends \PhpParser\NodeVisitorAbstract
Expanded class hierarchy of CloningVisitor
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ NodeVisitor/ CloningVisitor.php, line 13
Namespace
PhpParser\NodeVisitorView source
class CloningVisitor extends NodeVisitorAbstract {
public function enterNode(Node $origNode) {
$node = clone $origNode;
$node->setAttribute('origNode', $origNode);
return $node;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
CloningVisitor::enterNode | public | function | Called when entering a node. | Overrides NodeVisitorAbstract::enterNode | |
NodeVisitor::DONT_TRAVERSE_CHILDREN | public | constant | If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes of the current node will not be traversed for any visitors. |
||
NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN | public | constant | If NodeVisitor::enterNode() returns DONT_TRAVERSE_CURRENT_AND_CHILDREN, child nodes of the current node will not be traversed for any visitors. |
||
NodeVisitor::REMOVE_NODE | public | constant | If NodeVisitor::leaveNode() returns REMOVE_NODE for a node that occurs in an array, it will be removed from the array. |
||
NodeVisitor::REPLACE_WITH_NULL | public | constant | If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns REPLACE_WITH_NULL, the node will be replaced with null. This is not a legal return value if the node is part of an array, rather than another node. |
||
NodeVisitor::STOP_TRAVERSAL | public | constant | If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns STOP_TRAVERSAL, traversal is aborted. |
||
NodeVisitorAbstract::afterTraverse | public | function | Called once after traversal. | Overrides NodeVisitor::afterTraverse | 1 |
NodeVisitorAbstract::beforeTraverse | public | function | Called once before traversal. | Overrides NodeVisitor::beforeTraverse | 5 |
NodeVisitorAbstract::leaveNode | public | function | Called when leaving a node. | Overrides NodeVisitor::leaveNode | 2 |