X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fvalidator%2FConstraints%2FIsbnValidator.php;h=2e342673d37c8b8edea791ae47c06f0257a64293;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=6ca8488a5c72577dc2dc573e8d4d9eed2cfab3af;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/validator/Constraints/IsbnValidator.php b/vendor/symfony/validator/Constraints/IsbnValidator.php index 6ca8488a5..2e342673d 100644 --- a/vendor/symfony/validator/Constraints/IsbnValidator.php +++ b/vendor/symfony/validator/Constraints/IsbnValidator.php @@ -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(); } }