[Uid] Add RFC4122 UUID namespaces as constants

This commit is contained in:
Nicolas Grekas 2021-01-27 23:23:29 +01:00
parent 1a78e057d5
commit 4e73aeb169
2 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@ CHANGELOG
* Add `AbstractUid::fromBinary()`, `AbstractUid::fromBase58()`, `AbstractUid::fromBase32()` and `AbstractUid::fromRfc4122()` * Add `AbstractUid::fromBinary()`, `AbstractUid::fromBase58()`, `AbstractUid::fromBase32()` and `AbstractUid::fromRfc4122()`
* [BC BREAK] Replace `UuidV1::getTime()`, `UuidV6::getTime()` and `Ulid::getTime()` by `UuidV1::getDateTime()`, `UuidV6::getDateTime()` and `Ulid::getDateTime()` * [BC BREAK] Replace `UuidV1::getTime()`, `UuidV6::getTime()` and `Ulid::getTime()` by `UuidV1::getDateTime()`, `UuidV6::getDateTime()` and `Ulid::getDateTime()`
* Add `Uuid::NAMESPACE_*` constants from RFC4122
5.2.0 5.2.0
----- -----

View File

@ -15,9 +15,16 @@ namespace Symfony\Component\Uid;
* @experimental in 5.3 * @experimental in 5.3
* *
* @author Grégoire Pineau <lyrixx@lyrixx.info> * @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @see https://tools.ietf.org/html/rfc4122#appendix-C for details about namespaces
*/ */
class Uuid extends AbstractUid class Uuid extends AbstractUid
{ {
public const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
public const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
public const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8';
public const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';
protected const TYPE = 0; protected const TYPE = 0;
public function __construct(string $uuid) public function __construct(string $uuid)