Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/validator/Constraints/BicValidator.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line diff
--- a/vendor/symfony/validator/Constraints/BicValidator.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/symfony/validator/Constraints/BicValidator.php Thu Feb 28 13:21:36 2019 +0000 @@ -13,6 +13,7 @@ use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; /** * @author Michael Hirschler <michael.vhirsch@gmail.com> @@ -26,6 +27,10 @@ */ public function validate($value, Constraint $constraint) { + if (!$constraint instanceof Bic) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Bic'); + } + if (null === $value || '' === $value) { return; } @@ -33,7 +38,7 @@ $canonicalize = str_replace(' ', '', $value); // the bic must be either 8 or 11 characters long - if (!in_array(strlen($canonicalize), array(8, 11))) { + if (!\in_array(\strlen($canonicalize), [8, 11])) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(Bic::INVALID_LENGTH_ERROR)