Nessuna descrizione

NodeTraverserInterface.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace PhpParser;
  3. interface NodeTraverserInterface
  4. {
  5. /**
  6. * If NodeVisitor::enterNode() returns DONT_TRAVERSE_CHILDREN, child nodes
  7. * of the current node will not be traversed for any visitors.
  8. *
  9. * For subsequent visitors enterNode() will still be called on the current
  10. * node and leaveNode() will also be invoked for the current node.
  11. */
  12. const DONT_TRAVERSE_CHILDREN = 1;
  13. /**
  14. * If NodeVisitor::leaveNode() returns REMOVE_NODE for a node that occurs
  15. * in an array, it will be removed from the array.
  16. *
  17. * For subsequent visitors leaveNode() will still be invoked for the
  18. * removed node.
  19. */
  20. const REMOVE_NODE = false;
  21. /**
  22. * Adds a visitor.
  23. *
  24. * @param NodeVisitor $visitor Visitor to add
  25. */
  26. function addVisitor(NodeVisitor $visitor);
  27. /**
  28. * Removes an added visitor.
  29. *
  30. * @param NodeVisitor $visitor
  31. */
  32. function removeVisitor(NodeVisitor $visitor);
  33. /**
  34. * Traverses an array of nodes using the registered visitors.
  35. *
  36. * @param Node[] $nodes Array of nodes
  37. *
  38. * @return Node[] Traversed array of nodes
  39. */
  40. function traverse(array $nodes);
  41. }