[Uid] Use the Uuid constructor when reconstructing an Ulid from its RFC-4122 version

This commit is contained in:
Thomas Calvet 2021-01-05 18:11:49 +01:00
parent d4620a7d51
commit 44392cbc30

View File

@ -59,7 +59,7 @@ class Ulid extends AbstractUid
public static function fromString(string $ulid): parent
{
if (36 === \strlen($ulid) && Uuid::isValid($ulid)) {
$ulid = Uuid::fromString($ulid)->toBinary();
$ulid = (new Uuid($ulid))->toBinary();
} elseif (22 === \strlen($ulid) && 22 === strspn($ulid, BinaryUtil::BASE58[''])) {
$ulid = BinaryUtil::fromBase($ulid, BinaryUtil::BASE58);
}