X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fvalidator%2FConstraints%2FCurrencyValidator.php;h=42fa8cfa456827fd68af9de5c8b2a2318704e4e1;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=043bafad6aa65038648a8981d38ecdd0869c8ea0;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/validator/Constraints/CurrencyValidator.php b/vendor/symfony/validator/Constraints/CurrencyValidator.php index 043bafad6..42fa8cfa4 100644 --- a/vendor/symfony/validator/Constraints/CurrencyValidator.php +++ b/vendor/symfony/validator/Constraints/CurrencyValidator.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Intl\Intl; -use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; @@ -38,7 +37,7 @@ class CurrencyValidator extends ConstraintValidator return; } - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { throw new UnexpectedTypeException($value, 'string'); } @@ -46,17 +45,10 @@ class CurrencyValidator extends ConstraintValidator $currencies = Intl::getCurrencyBundle()->getCurrencyNames(); if (!isset($currencies[$value])) { - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Currency::NO_SUCH_CURRENCY_ERROR) - ->addViolation(); - } else { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Currency::NO_SUCH_CURRENCY_ERROR) - ->addViolation(); - } + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Currency::NO_SUCH_CURRENCY_ERROR) + ->addViolation(); } } }