X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fvalidator%2FValidator%2FRecursiveValidator.php;h=33c2ec9e4798f90d94b6c7484c28578cd86f79ec;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=abd29087bc08a103814e65a2b2d7d4cb873e3d5f;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/validator/Validator/RecursiveValidator.php b/vendor/symfony/validator/Validator/RecursiveValidator.php index abd29087b..33c2ec9e4 100644 --- a/vendor/symfony/validator/Validator/RecursiveValidator.php +++ b/vendor/symfony/validator/Validator/RecursiveValidator.php @@ -11,41 +11,22 @@ namespace Symfony\Component\Validator\Validator; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\GroupSequence; -use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; -use Symfony\Component\Validator\MetadataFactoryInterface; +use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; use Symfony\Component\Validator\ObjectInitializerInterface; -use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; /** * Recursive implementation of {@link ValidatorInterface}. * * @author Bernhard Schussek */ -class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface +class RecursiveValidator implements ValidatorInterface { - /** - * @var ExecutionContextFactoryInterface - */ protected $contextFactory; - - /** - * @var MetadataFactoryInterface - */ protected $metadataFactory; - - /** - * @var ConstraintValidatorFactoryInterface - */ protected $validatorFactory; - - /** - * @var ObjectInitializerInterface[] - */ protected $objectInitializers; /** @@ -113,21 +94,8 @@ class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface /** * {@inheritdoc} */ - public function validate($value, $groups = null, $traverse = false, $deep = false) + public function validate($value, $constraints = null, $groups = null) { - $numArgs = func_num_args(); - - // Use new signature if constraints are given in the second argument - if (self::testConstraints($groups) && ($numArgs < 3 || 3 === $numArgs && self::testGroups($traverse))) { - // Rename to avoid total confusion ;) - $constraints = $groups; - $groups = $traverse; - } else { - @trigger_error('The Symfony\Component\Validator\ValidatorInterface::validate method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED); - - $constraints = new Valid(array('traverse' => $traverse, 'deep' => $deep)); - } - return $this->startContext($value) ->validate($value, $constraints, $groups) ->getViolations(); @@ -149,38 +117,8 @@ class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) { // If a class name is passed, take $value as root - return $this->startContext(is_object($objectOrClass) ? $objectOrClass : $value) + return $this->startContext(\is_object($objectOrClass) ? $objectOrClass : $value) ->validatePropertyValue($objectOrClass, $propertyName, $value, $groups) ->getViolations(); } - - /** - * {@inheritdoc} - */ - public function validateValue($value, $constraints, $groups = null) - { - @trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED); - - return $this->validate($value, $constraints, $groups); - } - - /** - * {@inheritdoc} - */ - public function getMetadataFactory() - { - @trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED); - - return $this->metadataFactory; - } - - private static function testConstraints($constraints) - { - return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && (0 === count($constraints) || current($constraints) instanceof Constraint)); - } - - private static function testGroups($groups) - { - return null === $groups || is_string($groups) || $groups instanceof GroupSequence || (is_array($groups) && (0 === count($groups) || is_string(current($groups)) || current($groups) instanceof GroupSequence)); - } }