From d00edacf2e4c31deaa027130921142688b71396c Mon Sep 17 00:00:00 2001 From: Adam Misiorny Date: Thu, 17 Nov 2016 12:17:12 +0100 Subject: [PATCH] add support for all version of UUID [1-5] https://en.wikipedia.org/wiki/Universally_unique_identifier#Variants_and_versions --- src/Matcher/UuidMatcher.php | 2 +- tests/Matcher/UuidMatcherTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Matcher/UuidMatcher.php b/src/Matcher/UuidMatcher.php index 2332659f..933d109d 100644 --- a/src/Matcher/UuidMatcher.php +++ b/src/Matcher/UuidMatcher.php @@ -7,7 +7,7 @@ final class UuidMatcher extends Matcher { const UUID_PATTERN = '/^@uuid@$/'; - const UUID_FORMAT_PATTERN = '|^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$|'; + const UUID_FORMAT_PATTERN = '|^[\da-f]{8}-[\da-f]{4}-[1-5][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$|'; /** * {@inheritDoc} diff --git a/tests/Matcher/UuidMatcherTest.php b/tests/Matcher/UuidMatcherTest.php index cb6a7057..1267ea9d 100644 --- a/tests/Matcher/UuidMatcherTest.php +++ b/tests/Matcher/UuidMatcherTest.php @@ -66,7 +66,11 @@ public static function positiveCanMatchData() public static function positiveMatchData() { return array( + array("21627164-acb7-11e6-80f5-76304dec7eb7", "@uuid@"), + array("d9c04bc2-173f-2cb7-ad4e-e4ca3b2c273f", "@uuid@"), + array("7b368038-a5ca-3aa3-b0db-1177d1761c9e", "@uuid@"), array("9f4db639-0e87-4367-9beb-d64e3f42ae18", "@uuid@"), + array("1f2b1a18-81a0-5685-bca7-f23022ed7c7b", "@uuid@"), ); }