diff vendor/symfony/validator/Constraints/UuidValidator.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children
line wrap: on
line diff
--- a/vendor/symfony/validator/Constraints/UuidValidator.php	Thu Feb 28 11:14:44 2019 +0000
+++ b/vendor/symfony/validator/Constraints/UuidValidator.php	Thu Feb 28 13:11:55 2019 +0000
@@ -66,15 +66,15 @@
      */
     public function validate($value, Constraint $constraint)
     {
+        if (!$constraint instanceof Uuid) {
+            throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Uuid');
+        }
+
         if (null === $value || '' === $value) {
             return;
         }
 
-        if (!$constraint instanceof Uuid) {
-            throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Uuid');
-        }
-
-        if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) {
+        if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
             throw new UnexpectedTypeException($value, 'string');
         }
 
@@ -235,7 +235,7 @@
         }
 
         // Check version
-        if (!in_array($value[self::STRICT_VERSION_POSITION], $constraint->versions)) {
+        if (!\in_array($value[self::STRICT_VERSION_POSITION], $constraint->versions)) {
             $this->context->buildViolation($constraint->message)
                 ->setParameter('{{ value }}', $this->formatValue($value))
                 ->setCode(Uuid::INVALID_VERSION_ERROR)