X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fvalidator%2FConstraints%2FTimeValidator.php;fp=vendor%2Fsymfony%2Fvalidator%2FConstraints%2FTimeValidator.php;h=e398c10a2600206337879f083361f79a4b0abb46;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=b5b7b9ccd64649ca61848aa68cf00f54ed2e9009;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/symfony/validator/Constraints/TimeValidator.php b/vendor/symfony/validator/Constraints/TimeValidator.php index b5b7b9ccd..e398c10a2 100644 --- a/vendor/symfony/validator/Constraints/TimeValidator.php +++ b/vendor/symfony/validator/Constraints/TimeValidator.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; @@ -59,33 +58,19 @@ class TimeValidator extends ConstraintValidator $value = (string) $value; if (!preg_match(static::PATTERN, $value, $matches)) { - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Time::INVALID_FORMAT_ERROR) - ->addViolation(); - } else { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Time::INVALID_FORMAT_ERROR) - ->addViolation(); - } + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Time::INVALID_FORMAT_ERROR) + ->addViolation(); return; } if (!self::checkTime($matches[1], $matches[2], $matches[3])) { - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Time::INVALID_TIME_ERROR) - ->addViolation(); - } else { - $this->buildViolation($constraint->message) - ->setParameter('{{ value }}', $this->formatValue($value)) - ->setCode(Time::INVALID_TIME_ERROR) - ->addViolation(); - } + $this->context->buildViolation($constraint->message) + ->setParameter('{{ value }}', $this->formatValue($value)) + ->setCode(Time::INVALID_TIME_ERROR) + ->addViolation(); } } }