X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fsymfony%2Fvalidator%2FConstraints%2FTimeValidator.php;h=3f0234b8b0896ba3a164ceef0b9baebd3ba87d98;hb=9e65bae52407293a5182f19dc57b5628b09e92f4;hp=b5b7b9ccd64649ca61848aa68cf00f54ed2e9009;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/validator/Constraints/TimeValidator.php b/vendor/symfony/validator/Constraints/TimeValidator.php index b5b7b9ccd..3f0234b8b 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; @@ -48,7 +47,7 @@ class TimeValidator extends ConstraintValidator throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Time'); } - if (null === $value || '' === $value || $value instanceof \DateTime) { + if (null === $value || '' === $value || $value instanceof \DateTimeInterface) { return; } @@ -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(); } } }