minor #36064 [Uid] remove Uuid::getVariant() (nicolas-grekas)

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
-------

49efe9a5a9 [Uid] remove Uuid::getVariant()
This commit is contained in:
Fabien Potencier 2020-03-14 08:58:18 +01:00
commit aed93cdada
2 changed files with 0 additions and 11 deletions

View File

@ -132,7 +132,6 @@ class UuidTest extends TestCase
{
$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);

View File

@ -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.
@ -113,11 +108,6 @@ class Uuid implements \JsonSerializable
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)) {