vendor/symfony/validator/Constraints/Sequentially.php line 24

Open in your IDE?
  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\Constraints;
  11. /**
  12. * Use this constraint to sequentially validate nested constraints.
  13. * Validation for the nested constraints collection will stop at first violation.
  14. *
  15. * @Annotation
  16. * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
  17. *
  18. * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
  19. */
  20. #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
  21. class Sequentially extends Composite
  22. {
  23. public $constraints = [];
  24. public function __construct($constraints = null, ?array $groups = null, $payload = null)
  25. {
  26. parent::__construct($constraints ?? [], $groups, $payload);
  27. }
  28. public function getDefaultOption()
  29. {
  30. return 'constraints';
  31. }
  32. public function getRequiredOptions()
  33. {
  34. return ['constraints'];
  35. }
  36. protected function getCompositeOption()
  37. {
  38. return 'constraints';
  39. }
  40. public function getTargets()
  41. {
  42. return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT];
  43. }
  44. }