From 078feed166b75827bce50c59e1094d9f6a86cab4 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Mon, 12 Sep 2022 20:56:42 -0500 Subject: [PATCH] chore: update nomenclature --- src/Nonstandard/UuidV6.php | 6 +++--- src/Rfc4122/FieldsInterface.php | 3 ++- src/Rfc4122/UuidV1.php | 4 ++-- src/Rfc4122/UuidV6.php | 2 +- src/Uuid.php | 16 ++++------------ src/UuidFactoryInterface.php | 4 ++-- src/functions.php | 4 ++-- tests/Nonstandard/UuidV6Test.php | 2 +- tests/Rfc4122/UuidV6Test.php | 2 +- 9 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/Nonstandard/UuidV6.php b/src/Nonstandard/UuidV6.php index 8ea22fd..62409e5 100644 --- a/src/Nonstandard/UuidV6.php +++ b/src/Nonstandard/UuidV6.php @@ -25,7 +25,7 @@ use Ramsey\Uuid\Rfc4122\UuidV6ConverterTrait; use Ramsey\Uuid\Uuid; /** - * Reordered-time, or version 6, UUIDs include timestamp, clock sequence, and + * Reordered time, or version 6, UUIDs include timestamp, clock sequence, and * node values that are combined into a 128-bit unsigned integer * * @deprecated Use {@see \Ramsey\Uuid\Rfc4122\UuidV6} instead. @@ -41,7 +41,7 @@ class UuidV6 extends Uuid implements UuidInterface use UuidV6ConverterTrait; /** - * Creates a version 6 (reordered-time) UUID + * Creates a version 6 (reordered time) UUID * * @param Rfc4122FieldsInterface $fields The fields from which to construct a UUID * @param NumberConverterInterface $numberConverter The number converter to use @@ -60,7 +60,7 @@ class UuidV6 extends Uuid implements UuidInterface if ($fields->getVersion() !== Uuid::UUID_TYPE_REORDERED_TIME) { throw new InvalidArgumentException( 'Fields used to create a UuidV6 must represent a ' - . 'version 6 (ordered-time) UUID' + . 'version 6 (reordered time) UUID' ); } diff --git a/src/Rfc4122/FieldsInterface.php b/src/Rfc4122/FieldsInterface.php index a303525..a0cc4f4 100644 --- a/src/Rfc4122/FieldsInterface.php +++ b/src/Rfc4122/FieldsInterface.php @@ -103,11 +103,12 @@ interface FieldsInterface extends BaseFieldsInterface * The version number describes how the UUID was generated and has the * following meaning: * - * 1. Time-based UUID + * 1. Gregorian time UUID * 2. DCE security UUID * 3. Name-based UUID hashed with MD5 * 4. Randomly generated UUID * 5. Name-based UUID hashed with SHA-1 + * 6. Reordered time UUID * * This returns `null` if the UUID is not an RFC 4122 variant, since version * is only meaningful for this variant. diff --git a/src/Rfc4122/UuidV1.php b/src/Rfc4122/UuidV1.php index 8a9cad2..515c038 100644 --- a/src/Rfc4122/UuidV1.php +++ b/src/Rfc4122/UuidV1.php @@ -22,7 +22,7 @@ use Ramsey\Uuid\Rfc4122\FieldsInterface as Rfc4122FieldsInterface; use Ramsey\Uuid\Uuid; /** - * Time-based, or version 1, UUIDs include timestamp, clock sequence, and node + * Gregorian time, or version 1, UUIDs include timestamp, clock sequence, and node * values that are combined into a 128-bit unsigned integer * * @psalm-immutable @@ -32,7 +32,7 @@ final class UuidV1 extends Uuid implements UuidInterface use TimeTrait; /** - * Creates a version 1 (time-based) UUID + * Creates a version 1 (Gregorian time) UUID * * @param Rfc4122FieldsInterface $fields The fields from which to construct a UUID * @param NumberConverterInterface $numberConverter The number converter to use diff --git a/src/Rfc4122/UuidV6.php b/src/Rfc4122/UuidV6.php index 8b8c4b7..9b2ddee 100644 --- a/src/Rfc4122/UuidV6.php +++ b/src/Rfc4122/UuidV6.php @@ -17,7 +17,7 @@ namespace Ramsey\Uuid\Rfc4122; use Ramsey\Uuid\Nonstandard\UuidV6 as NonstandardUuidV6; /** - * Reordered-time, or version 6, UUIDs include timestamp, clock sequence, and + * Reordered time, or version 6, UUIDs include timestamp, clock sequence, and * node values that are combined into a 128-bit unsigned integer * * @link https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04#section-5.1 UUID Version 6 diff --git a/src/Uuid.php b/src/Uuid.php index 3a7c8ec..deaa58e 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -116,7 +116,7 @@ class Uuid implements UuidInterface public const VALID_PATTERN = '^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$'; /** - * Version 1 (time-based) UUID + * Version 1 (Gregorian time) UUID * * @link https://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, ยง 4.1.3: Version */ @@ -156,20 +156,12 @@ class Uuid implements UuidInterface public const UUID_TYPE_HASH_SHA1 = 5; /** - * Version 6 (reordered-time) UUID - * - * 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 Use {@see Uuid::UUID_TYPE_REORDERED_TIME} instead. - * - * @link https://github.com/uuid6/uuid6-ietf-draft UUID version 6 IETF draft - * @link http://gh.peabody.io/uuidv6/ "Version 6" UUIDs */ public const UUID_TYPE_PEABODY = 6; /** - * Version 6 (reordered-time) UUID + * Version 6 (reordered time) UUID * * @link https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04#section-5.1 UUID Version 6 */ @@ -555,7 +547,7 @@ class Uuid implements UuidInterface } /** - * Returns a version 1 (time-based) UUID from a host ID, sequence number, + * Returns a version 1 (Gregorian time) UUID from a host ID, sequence number, * and the current time * * @param Hexadecimal|int|string|null $node A 48-bit number representing the @@ -660,7 +652,7 @@ class Uuid implements UuidInterface } /** - * Returns a version 6 (ordered-time) UUID from a host ID, sequence number, + * Returns a version 6 (reordered time) UUID from a host ID, sequence number, * and the current time * * @param Hexadecimal|null $node A 48-bit number representing the hardware diff --git a/src/UuidFactoryInterface.php b/src/UuidFactoryInterface.php index bc0e615..d99fc9d 100644 --- a/src/UuidFactoryInterface.php +++ b/src/UuidFactoryInterface.php @@ -88,7 +88,7 @@ interface UuidFactoryInterface public function getValidator(): ValidatorInterface; /** - * Returns a version 1 (time-based) UUID from a host ID, sequence number, + * Returns a version 1 (Gregorian time) UUID from a host ID, sequence number, * and the current time * * @param Hexadecimal|int|string|null $node A 48-bit number representing the @@ -166,7 +166,7 @@ interface UuidFactoryInterface public function uuid5($ns, string $name): UuidInterface; /** - * Returns a version 6 (ordered-time) UUID from a host ID, sequence number, + * Returns a version 6 (reordered time) UUID from a host ID, sequence number, * and the current time * * @param Hexadecimal|null $node A 48-bit number representing the hardware diff --git a/src/functions.php b/src/functions.php index d722f06..c3d3b49 100644 --- a/src/functions.php +++ b/src/functions.php @@ -19,7 +19,7 @@ use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Integer as IntegerObject; /** - * Returns a version 1 (time-based) UUID from a host ID, sequence number, + * Returns a version 1 (Gregorian time) UUID from a host ID, sequence number, * and the current time * * @param Hexadecimal|int|string|null $node A 48-bit number representing the @@ -106,7 +106,7 @@ function v5($ns, string $name): string } /** - * Returns a version 6 (ordered-time) UUID from a host ID, sequence number, + * Returns a version 6 (reordered time) UUID from a host ID, sequence number, * and the current time * * @param Hexadecimal|null $node A 48-bit number representing the hardware diff --git a/tests/Nonstandard/UuidV6Test.php b/tests/Nonstandard/UuidV6Test.php index 0df8103..e5c71b4 100644 --- a/tests/Nonstandard/UuidV6Test.php +++ b/tests/Nonstandard/UuidV6Test.php @@ -37,7 +37,7 @@ class UuidV6Test extends TestCase $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( 'Fields used to create a UuidV6 must represent a ' - . 'version 6 (ordered-time) UUID' + . 'version 6 (reordered time) UUID' ); new UuidV6($fields, $numberConverter, $codec, $timeConverter); diff --git a/tests/Rfc4122/UuidV6Test.php b/tests/Rfc4122/UuidV6Test.php index 1c72528..e9f74d6 100644 --- a/tests/Rfc4122/UuidV6Test.php +++ b/tests/Rfc4122/UuidV6Test.php @@ -37,7 +37,7 @@ class UuidV6Test extends TestCase $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( 'Fields used to create a UuidV6 must represent a ' - . 'version 6 (ordered-time) UUID' + . 'version 6 (reordered time) UUID' ); new UuidV6($fields, $numberConverter, $codec, $timeConverter);