Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / validator / Constraints / UuidValidator.php
index b0b4e8a7d8ec028161d68f2f6933e5091f940d5f..be177e2255ffba8a37013bc5fff555b41fc9f54f 100644 (file)
@@ -16,13 +16,19 @@ use Symfony\Component\Validator\ConstraintValidator;
 use Symfony\Component\Validator\Exception\UnexpectedTypeException;
 
 /**
- * Validates whether the value is a valid UUID per RFC 4122.
+ * Validates whether the value is a valid UUID (also known as GUID).
+ *
+ * Strict validation will allow a UUID as specified per RFC 4122.
+ * Loose validation will allow any type of UUID.
+ *
+ * For better compatibility, both loose and strict, you should consider using a specialized UUID library like "ramsey/uuid" instead.
  *
  * @author Colin O'Dell <colinodell@gmail.com>
  * @author Bernhard Schussek <bschussek@gmail.com>
  *
  * @see http://tools.ietf.org/html/rfc4122
  * @see https://en.wikipedia.org/wiki/Universally_unique_identifier
+ * @see https://github.com/ramsey/uuid
  */
 class UuidValidator extends ConstraintValidator
 {
@@ -240,7 +246,7 @@ class UuidValidator extends ConstraintValidator
         //   0b10xx
         // & 0b1100 (12)
         // = 0b1000 (8)
-        if ((hexdec($value[self::STRICT_VARIANT_POSITION]) & 12) !== 8) {
+        if (8 !== (hexdec($value[self::STRICT_VARIANT_POSITION]) & 12)) {
             $this->context->buildViolation($constraint->message)
                 ->setParameter('{{ value }}', $this->formatValue($value))
                 ->setCode(Uuid::INVALID_VARIANT_ERROR)