Mercurial > hg > isophonics-drupal-site
diff vendor/symfony/validator/Constraints/CountValidator.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/CountValidator.php Tue Jul 10 15:07:59 2018 +0100 +++ b/vendor/symfony/validator/Constraints/CountValidator.php Thu Feb 28 13:21:36 2019 +0000 @@ -25,15 +25,19 @@ */ public function validate($value, Constraint $constraint) { + if (!$constraint instanceof Count) { + throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Count'); + } + if (null === $value) { return; } - if (!is_array($value) && !$value instanceof \Countable) { + if (!\is_array($value) && !$value instanceof \Countable) { throw new UnexpectedTypeException($value, 'array or \Countable'); } - $count = count($value); + $count = \count($value); if (null !== $constraint->max && $count > $constraint->max) { $this->context->buildViolation($constraint->min == $constraint->max ? $constraint->exactMessage : $constraint->maxMessage)