Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / validator / Constraints / IsbnValidator.php
index 6ca8488a5c72577dc2dc573e8d4d9eed2cfab3af..2e342673d37c8b8edea791ae47c06f0257a64293 100644 (file)
@@ -11,7 +11,6 @@
 
 namespace Symfony\Component\Validator\Constraints;
 
-use Symfony\Component\Validator\Context\ExecutionContextInterface;
 use Symfony\Component\Validator\Constraint;
 use Symfony\Component\Validator\ConstraintValidator;
 use Symfony\Component\Validator\Exception\UnexpectedTypeException;
@@ -47,30 +46,13 @@ class IsbnValidator extends ConstraintValidator
         $value = (string) $value;
         $canonical = str_replace('-', '', $value);
 
-        if (null === $constraint->type) {
-            if ($constraint->isbn10 && !$constraint->isbn13) {
-                @trigger_error('The "isbn10" option of the Isbn constraint is deprecated since version 2.5 and will be removed in 3.0. Use the "type" option instead.', E_USER_DEPRECATED);
-                $constraint->type = 'isbn10';
-            } elseif ($constraint->isbn13 && !$constraint->isbn10) {
-                @trigger_error('The "isbn13" option of the Isbn constraint is deprecated since version 2.5 and will be removed in 3.0. Use the "type" option instead.', E_USER_DEPRECATED);
-                $constraint->type = 'isbn13';
-            }
-        }
-
         // Explicitly validate against ISBN-10
         if ('isbn10' === $constraint->type) {
             if (true !== ($code = $this->validateIsbn10($canonical))) {
-                if ($this->context instanceof ExecutionContextInterface) {
-                    $this->context->buildViolation($this->getMessage($constraint, $constraint->type))
-                        ->setParameter('{{ value }}', $this->formatValue($value))
-                        ->setCode($code)
-                        ->addViolation();
-                } else {
-                    $this->buildViolation($this->getMessage($constraint, $constraint->type))
-                        ->setParameter('{{ value }}', $this->formatValue($value))
-                        ->setCode($code)
-                        ->addViolation();
-                }
+                $this->context->buildViolation($this->getMessage($constraint, $constraint->type))
+                    ->setParameter('{{ value }}', $this->formatValue($value))
+                    ->setCode($code)
+                    ->addViolation();
             }
 
             return;
@@ -79,17 +61,10 @@ class IsbnValidator extends ConstraintValidator
         // Explicitly validate against ISBN-13
         if ('isbn13' === $constraint->type) {
             if (true !== ($code = $this->validateIsbn13($canonical))) {
-                if ($this->context instanceof ExecutionContextInterface) {
-                    $this->context->buildViolation($this->getMessage($constraint, $constraint->type))
-                        ->setParameter('{{ value }}', $this->formatValue($value))
-                        ->setCode($code)
-                        ->addViolation();
-                } else {
-                    $this->buildViolation($this->getMessage($constraint, $constraint->type))
-                        ->setParameter('{{ value }}', $this->formatValue($value))
-                        ->setCode($code)
-                        ->addViolation();
-                }
+                $this->context->buildViolation($this->getMessage($constraint, $constraint->type))
+                    ->setParameter('{{ value }}', $this->formatValue($value))
+                    ->setCode($code)
+                    ->addViolation();
             }
 
             return;
@@ -112,17 +87,10 @@ class IsbnValidator extends ConstraintValidator
         }
 
         if (true !== $code) {
-            if ($this->context instanceof ExecutionContextInterface) {
-                $this->context->buildViolation($this->getMessage($constraint))
-                    ->setParameter('{{ value }}', $this->formatValue($value))
-                    ->setCode($code)
-                    ->addViolation();
-            } else {
-                $this->buildViolation($this->getMessage($constraint))
-                    ->setParameter('{{ value }}', $this->formatValue($value))
-                    ->setCode($code)
-                    ->addViolation();
-            }
+            $this->context->buildViolation($this->getMessage($constraint))
+                ->setParameter('{{ value }}', $this->formatValue($value))
+                ->setCode($code)
+                ->addViolation();
         }
     }