Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / validator / Context / ExecutionContext.php
index 721766a2533830fa104d10476f785e5d1ac17211..1dc982c2719ffb3e50eae4f4129486332b68b1ef 100644 (file)
 namespace Symfony\Component\Validator\Context;
 
 use Symfony\Component\Translation\TranslatorInterface;
-use Symfony\Component\Validator\ClassBasedInterface;
 use Symfony\Component\Validator\Constraint;
-use Symfony\Component\Validator\Constraints\Valid;
 use Symfony\Component\Validator\ConstraintViolation;
 use Symfony\Component\Validator\ConstraintViolationList;
+use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
 use Symfony\Component\Validator\Mapping\MetadataInterface;
+use Symfony\Component\Validator\Mapping\MemberMetadata;
 use Symfony\Component\Validator\Mapping\PropertyMetadataInterface;
 use Symfony\Component\Validator\Util\PropertyPath;
 use Symfony\Component\Validator\Validator\ValidatorInterface;
-use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
 use Symfony\Component\Validator\Violation\ConstraintViolationBuilder;
 
 /**
@@ -181,25 +180,8 @@ class ExecutionContext implements ExecutionContextInterface
     /**
      * {@inheritdoc}
      */
-    public function addViolation($message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
+    public function addViolation($message, array $parameters = array())
     {
-        // The parameters $invalidValue and following are ignored by the new
-        // API, as they are not present in the new interface anymore.
-        // You should use buildViolation() instead.
-        if (func_num_args() > 2) {
-            @trigger_error('The parameters $invalidValue, $plural and $code in method '.__METHOD__.' are deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
-
-            $this
-                ->buildViolation($message, $parameters)
-                ->setInvalidValue($invalidValue)
-                ->setPlural($plural)
-                ->setCode($code)
-                ->addViolation()
-            ;
-
-            return;
-        }
-
         $this->violations->add(new ConstraintViolation(
             $this->translator->trans($message, $parameters, $this->translationDomain),
             $message,
@@ -297,7 +279,7 @@ class ExecutionContext implements ExecutionContextInterface
      */
     public function getClassName()
     {
-        return $this->metadata instanceof ClassBasedInterface ? $this->metadata->getClassName() : null;
+        return $this->metadata instanceof MemberMetadata || $this->metadata instanceof ClassMetadataInterface ? $this->metadata->getClassName() : null;
     }
 
     /**
@@ -316,103 +298,6 @@ class ExecutionContext implements ExecutionContextInterface
         return PropertyPath::append($this->propertyPath, $subPath);
     }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
-    {
-        @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
-
-        if (func_num_args() > 2) {
-            $this
-                ->buildViolation($message, $parameters)
-                ->atPath($subPath)
-                ->setInvalidValue($invalidValue)
-                ->setPlural($plural)
-                ->setCode($code)
-                ->addViolation()
-            ;
-
-            return;
-        }
-
-        $this
-            ->buildViolation($message, $parameters)
-            ->atPath($subPath)
-            ->addViolation()
-        ;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false)
-    {
-        @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
-
-        if (is_array($value)) {
-            // The $traverse flag is ignored for arrays
-            $constraint = new Valid(array('traverse' => true, 'deep' => $deep));
-
-            return $this
-                ->getValidator()
-                ->inContext($this)
-                ->atPath($subPath)
-                ->validate($value, $constraint, $groups)
-            ;
-        }
-
-        if ($traverse && $value instanceof \Traversable) {
-            $constraint = new Valid(array('traverse' => true, 'deep' => $deep));
-
-            return $this
-                ->getValidator()
-                ->inContext($this)
-                ->atPath($subPath)
-                ->validate($value, $constraint, $groups)
-            ;
-        }
-
-        return $this
-            ->getValidator()
-            ->inContext($this)
-            ->atPath($subPath)
-            ->validate($value, null, $groups)
-        ;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function validateValue($value, $constraints, $subPath = '', $groups = null)
-    {
-        @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
-
-        return $this
-            ->getValidator()
-            ->inContext($this)
-            ->atPath($subPath)
-            ->validate($value, $constraints, $groups)
-        ;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getMetadataFactory()
-    {
-        @trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext::getValidator method in combination with Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
-
-        $validator = $this->getValidator();
-
-        if ($validator instanceof LegacyValidatorInterface) {
-            return $validator->getMetadataFactory();
-        }
-
-        // The ValidatorInterface extends from the deprecated MetadataFactoryInterface, so return it when we don't have the factory instance itself
-        return $validator;
-    }
-
     /**
      * {@inheritdoc}
      */