From 20831103160fd5dac2090df8b1997977ed782e42 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Fri, 12 Aug 2022 20:16:41 -0500 Subject: [PATCH] feat: deprecate variant and version constants --- psalm-baseline.xml | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/Uuid.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 8ddfeaf..b5f529e 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -16,6 +16,12 @@ $this + + + Uuid::UUID_TYPE_TIME + Uuid::UUID_TYPE_TIME + + $this @@ -67,6 +73,12 @@ uuid_parse + + + Uuid::RESERVED_MICROSOFT + Uuid::RFC_4122 + + Guid @@ -109,6 +121,9 @@ + + Uuid::UUID_TYPE_PEABODY + UuidV6 @@ -133,6 +148,13 @@ $macs[] + + + Uuid::RFC_4122 + Uuid::UUID_TYPE_DCE_SECURITY + Uuid::UUID_TYPE_PEABODY + + NilUuid @@ -161,6 +183,9 @@ + + Uuid::UUID_TYPE_TIME + UuidV1 @@ -169,6 +194,9 @@ + + Uuid::UUID_TYPE_DCE_SECURITY + UuidV2 @@ -177,6 +205,9 @@ + + Uuid::UUID_TYPE_HASH_MD5 + UuidV3 @@ -185,6 +216,9 @@ + + Uuid::UUID_TYPE_RANDOM + UuidV4 @@ -193,6 +227,9 @@ + + Uuid::UUID_TYPE_HASH_SHA1 + UuidV5 @@ -200,6 +237,14 @@ parent::__construct($fields, $numberConverter, $codec, $timeConverter) + + + Uuid::RESERVED_FUTURE + Uuid::RESERVED_MICROSOFT + Uuid::RESERVED_NCS + Uuid::RFC_4122 + + unserialize diff --git a/src/Uuid.php b/src/Uuid.php index c849cfd..7d0317f 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -85,6 +85,9 @@ class Uuid implements UuidInterface /** * Variant: reserved, NCS backward compatibility * + * @deprecated The Ramsey\Uuid\Variant enum will replace this constant in + * ramsey/uuid version 5. + * * @link http://tools.ietf.org/html/rfc4122#section-4.1.1 RFC 4122, § 4.1.1: Variant */ public const RESERVED_NCS = 0; @@ -92,6 +95,9 @@ class Uuid implements UuidInterface /** * Variant: the UUID layout specified in RFC 4122 * + * @deprecated The Ramsey\Uuid\Variant enum will replace this constant in + * ramsey/uuid version 5. + * * @link http://tools.ietf.org/html/rfc4122#section-4.1.1 RFC 4122, § 4.1.1: Variant */ public const RFC_4122 = 2; @@ -99,6 +105,9 @@ class Uuid implements UuidInterface /** * Variant: reserved, Microsoft Corporation backward compatibility * + * @deprecated The Ramsey\Uuid\Variant enum will replace this constant in + * ramsey/uuid version 5. + * * @link http://tools.ietf.org/html/rfc4122#section-4.1.1 RFC 4122, § 4.1.1: Variant */ public const RESERVED_MICROSOFT = 6; @@ -106,6 +115,9 @@ class Uuid implements UuidInterface /** * Variant: reserved for future definition * + * @deprecated The Ramsey\Uuid\Variant enum will replace this constant in + * ramsey/uuid version 5. + * * @link http://tools.ietf.org/html/rfc4122#section-4.1.1 RFC 4122, § 4.1.1: Variant */ public const RESERVED_FUTURE = 7; @@ -118,6 +130,9 @@ class Uuid implements UuidInterface /** * Version 1 (time-based) UUID * + * @deprecated The Ramsey\Uuid\Version enum will replace this constant in + * ramsey/uuid version 5. + * * @link https://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, § 4.1.3: Version */ public const UUID_TYPE_TIME = 1; @@ -125,6 +140,9 @@ class Uuid implements UuidInterface /** * Version 2 (DCE Security) UUID * + * @deprecated The Ramsey\Uuid\Version enum will replace this constant in + * ramsey/uuid version 5. + * * @link https://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, § 4.1.3: Version */ public const UUID_TYPE_DCE_SECURITY = 2; @@ -137,6 +155,9 @@ class Uuid implements UuidInterface /** * Version 3 (name-based and hashed with MD5) UUID * + * @deprecated The Ramsey\Uuid\Version enum will replace this constant in + * ramsey/uuid version 5. + * * @link https://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, § 4.1.3: Version */ public const UUID_TYPE_HASH_MD5 = 3; @@ -144,6 +165,9 @@ class Uuid implements UuidInterface /** * Version 4 (random) UUID * + * @deprecated The Ramsey\Uuid\Version enum will replace this constant in + * ramsey/uuid version 5. + * * @link https://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, § 4.1.3: Version */ public const UUID_TYPE_RANDOM = 4; @@ -151,6 +175,9 @@ class Uuid implements UuidInterface /** * Version 5 (name-based and hashed with SHA1) UUID * + * @deprecated The Ramsey\Uuid\Version enum will replace this constant in + * ramsey/uuid version 5. + * * @link https://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, § 4.1.3: Version */ public const UUID_TYPE_HASH_SHA1 = 5; @@ -161,6 +188,9 @@ class Uuid implements UuidInterface * This is named `UUID_TYPE_PEABODY`, since the specification is still in * draft form, and the primary author/editor's name is Brad Peabody. * + * @deprecated The Ramsey\Uuid\Version enum will replace this constant in + * ramsey/uuid version 5. + * * @link https://github.com/uuid6/uuid6-ietf-draft UUID version 6 IETF draft * @link http://gh.peabody.io/uuidv6/ "Version 6" UUIDs */