X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fvalidator%2FConstraints%2FChoiceValidator.php;h=e53b99a0d839e76d95b92f3cbe56bcce24e18a01;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=43fecb1137fdb67aedaee1978cb87429ed73f0a1;hpb=af6d1fb995500ae68849458ee10d66abbdcfb252;p=yaffs-website diff --git a/vendor/symfony/validator/Constraints/ChoiceValidator.php b/vendor/symfony/validator/Constraints/ChoiceValidator.php index 43fecb113..e53b99a0d 100644 --- a/vendor/symfony/validator/Constraints/ChoiceValidator.php +++ b/vendor/symfony/validator/Constraints/ChoiceValidator.php @@ -34,7 +34,7 @@ class ChoiceValidator extends ConstraintValidator throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Choice'); } - if (!is_array($constraint->choices) && !$constraint->callback) { + if (!\is_array($constraint->choices) && !$constraint->callback) { throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice'); } @@ -42,18 +42,18 @@ class ChoiceValidator extends ConstraintValidator return; } - if ($constraint->multiple && !is_array($value)) { + if ($constraint->multiple && !\is_array($value)) { throw new UnexpectedTypeException($value, 'array'); } if ($constraint->callback) { - if (!is_callable($choices = array($this->context->getObject(), $constraint->callback)) - && !is_callable($choices = array($this->context->getClassName(), $constraint->callback)) - && !is_callable($choices = $constraint->callback) + if (!\is_callable($choices = array($this->context->getObject(), $constraint->callback)) + && !\is_callable($choices = array($this->context->getClassName(), $constraint->callback)) + && !\is_callable($choices = $constraint->callback) ) { throw new ConstraintDefinitionException('The Choice constraint expects a valid callback'); } - $choices = call_user_func($choices); + $choices = \call_user_func($choices); } else { $choices = $constraint->choices; } @@ -64,7 +64,7 @@ class ChoiceValidator extends ConstraintValidator if ($constraint->multiple) { foreach ($value as $_value) { - if (!in_array($_value, $choices, $constraint->strict)) { + if (!\in_array($_value, $choices, $constraint->strict)) { $this->context->buildViolation($constraint->multipleMessage) ->setParameter('{{ value }}', $this->formatValue($_value)) ->setCode(Choice::NO_SUCH_CHOICE_ERROR) @@ -75,7 +75,7 @@ class ChoiceValidator extends ConstraintValidator } } - $count = count($value); + $count = \count($value); if (null !== $constraint->min && $count < $constraint->min) { $this->context->buildViolation($constraint->minMessage) @@ -96,7 +96,7 @@ class ChoiceValidator extends ConstraintValidator return; } - } elseif (!in_array($value, $choices, $constraint->strict)) { + } elseif (!\in_array($value, $choices, $constraint->strict)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(Choice::NO_SUCH_CHOICE_ERROR)