diff --git a/src/Uuid.php b/src/Uuid.php index 945480b..5f0922b 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -476,10 +476,11 @@ class Uuid implements UuidInterface */ public static function fromString(string $uuid): UuidInterface { + $uuid = strtolower($uuid); if (! self::$factoryReplaced && preg_match(LazyUuidFromString::VALID_REGEX, $uuid) === 1) { assert($uuid !== ''); - return new LazyUuidFromString(strtolower($uuid)); + return new LazyUuidFromString($uuid); } return self::getFactory()->fromString($uuid); diff --git a/tests/UuidTest.php b/tests/UuidTest.php index 29f1761..2ebac1d 100644 --- a/tests/UuidTest.php +++ b/tests/UuidTest.php @@ -132,6 +132,17 @@ class UuidTest extends TestCase Uuid::fromString(''); } + public function testFromStringUppercase(): void + { + $uuid = Uuid::fromString('FF6F8CB0-C57D-11E1-9B21-0800200C9A66'); + $this->assertSame('ff6f8cb0-c57d-11e1-9b21-0800200c9a66', $uuid->toString()); + } + + public function testFromStringLazyUuidFromUppercase(): void + { + $this->assertInstanceOf(LazyUuidFromString::class, Uuid::fromString('FF6F8CB0-C57D-11E1-9B21-0800200C9A66')); + } + public function testGetBytes(): void { $uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');