vendor/symfony/validator/Constraints/Valid.php line 23

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. use Symfony\Component\Validator\Constraint;
  12. /**
  13.  * @Annotation
  14.  * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
  15.  *
  16.  * @author Bernhard Schussek <bschussek@gmail.com>
  17.  */
  18. #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
  19. class Valid extends Constraint
  20. {
  21.     public $traverse true;
  22.     public function __get(string $option)
  23.     {
  24.         if ('groups' === $option) {
  25.             // when this is reached, no groups have been configured
  26.             return null;
  27.         }
  28.         return parent::__get($option);
  29.     }
  30.     /**
  31.      * {@inheritdoc}
  32.      */
  33.     public function addImplicitGroupName(string $group)
  34.     {
  35.         if (null !== $this->groups) {
  36.             parent::addImplicitGroupName($group);
  37.         }
  38.     }
  39. }