Skip to content

Commit

Permalink
minor #36064 [Uid] remove Uuid::getVariant() (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Uid] remove Uuid::getVariant()

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Let's simplify the API. One less concept to grasp.
I think there are no use cases for variants in modern tech, check:
https://en.wikipedia.org/wiki/Universally_unique_identifier#Variants

Commits
-------

49efe9a [Uid] remove Uuid::getVariant()
  • Loading branch information
fabpot committed Mar 14, 2020
2 parents cc73b1e + 49efe9a commit aed93cd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/Symfony/Component/Uid/Tests/UuidTest.php
Expand Up @@ -132,7 +132,6 @@ public function testExtraMethods()
{
$uuid = new Uuid(self::A_UUID_V1);

$this->assertSame(Uuid::VARIANT_DCE, $uuid->getVariant());
$this->assertSame(1583245966.746458, $uuid->getTime());
$this->assertSame('3499710062d0', $uuid->getMac());
$this->assertSame(self::A_UUID_V1, (string) $uuid);
Expand Down
10 changes: 0 additions & 10 deletions src/Symfony/Component/Uid/Uuid.php
Expand Up @@ -23,11 +23,6 @@ class Uuid implements \JsonSerializable
public const TYPE_4 = UUID_TYPE_RANDOM;
public const TYPE_5 = UUID_TYPE_SHA1;

public const VARIANT_NCS = UUID_VARIANT_NCS;
public const VARIANT_DCE = UUID_VARIANT_DCE;
public const VARIANT_MICROSOFT = UUID_VARIANT_MICROSOFT;
public const VARIANT_OTHER = UUID_VARIANT_OTHER;

// https://tools.ietf.org/html/rfc4122#section-4.1.4
// 0x01b21dd213814000 is the number of 100-ns intervals between the
// UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
Expand Down Expand Up @@ -113,11 +108,6 @@ public function getType(): int
return uuid_type($this->uuid);
}

public function getVariant(): int
{
return uuid_variant($this->uuid);
}

public function getTime(): float
{
if (self::TYPE_1 !== $t = uuid_type($this->uuid)) {
Expand Down

0 comments on commit aed93cd

Please sign in to comment.