TraversalStrategy.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. * @since 2.1
  24. *
  25. * @author Bernhard Schussek <bschussek@gmail.com>
  26. *
  27. * @see CascadingStrategy
  28. */
  29. class TraversalStrategy
  30. {
  31. /**
  32. * Specifies that a node's value should be iterated only if it is an
  33. * instance of {@link \Traversable}.
  34. */
  35. const IMPLICIT = 1;
  36. /**
  37. * Specifies that a node's value should never be iterated.
  38. */
  39. const NONE = 2;
  40. /**
  41. * Specifies that a node's value should always be iterated. If the value is
  42. * not an instance of {@link \Traversable}, an exception should be thrown.
  43. */
  44. const TRAVERSE = 4;
  45. /**
  46. * Specifies that nested instances of {@link \Traversable} should never be
  47. * iterated. Can be combined with {@link IMPLICIT} or {@link TRAVERSE}.
  48. *
  49. * @deprecated since version 2.5, to be removed in 3.0. This constant was added for backwards compatibility only.
  50. *
  51. * @internal
  52. */
  53. const STOP_RECURSION = 8;
  54. /**
  55. * Not instantiable.
  56. */
  57. private function __construct()
  58. {
  59. }
  60. }