TraversalStrategy.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Mapping;
  11. /**
  12. * Specifies whether and how a traversable object should be traversed.
  13. *
  14. * If the node traverser traverses a node whose value is an instance of
  15. * {@link \Traversable}, and if that node is either a class node or if
  16. * cascading is enabled, then the node's traversal strategy will be checked.
  17. * Depending on the requested traversal strategy, the node traverser will
  18. * iterate over the object and cascade each object or collection returned by
  19. * the iterator.
  20. *
  21. * The traversal strategy is ignored for arrays. Arrays are always iterated.
  22. *
  23. * @author Bernhard Schussek <bschussek@gmail.com>
  24. *
  25. * @see CascadingStrategy
  26. */
  27. class TraversalStrategy
  28. {
  29. /**
  30. * Specifies that a node's value should be iterated only if it is an
  31. * instance of {@link \Traversable}.
  32. */
  33. const IMPLICIT = 1;
  34. /**
  35. * Specifies that a node's value should never be iterated.
  36. */
  37. const NONE = 2;
  38. /**
  39. * Specifies that a node's value should always be iterated. If the value is
  40. * not an instance of {@link \Traversable}, an exception should be thrown.
  41. */
  42. const TRAVERSE = 4;
  43. /**
  44. * Specifies that nested instances of {@link \Traversable} should never be
  45. * iterated. Can be combined with {@link IMPLICIT} or {@link TRAVERSE}.
  46. *
  47. * @deprecated since version 2.5, to be removed in 3.0. This constant was added for backwards compatibility only.
  48. *
  49. * @internal
  50. */
  51. const STOP_RECURSION = 8;
  52. /**
  53. * Not instantiable.
  54. */
  55. private function __construct()
  56. {
  57. }
  58. }