mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-26 17:46:38 +03:00
Remove deprecated getClockSequenceHex() method
This commit is contained in:
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
* Remove the following deprecated methods from Uuid classes:
|
||||
* `getClockSeqHiAndReservedHex()`
|
||||
* `getClockSeqLowHex()`
|
||||
* `getClockSequenceHex()`
|
||||
* Remove dependency on ramsey/collection package.
|
||||
|
||||
|
||||
|
||||
@@ -39,14 +39,6 @@ interface DeprecatedUuidInterface
|
||||
*/
|
||||
public function getFieldsHex(): array;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@see UuidInterface::getFields()} to get a
|
||||
* {@see FieldsInterface} instance. If it is a
|
||||
* {@see \Ramsey\Uuid\Rfc4122\FieldsInterface} instance, you may call
|
||||
* {@see \Ramsey\Uuid\Rfc4122\FieldsInterface::getClockSeq()}.
|
||||
*/
|
||||
public function getClockSequenceHex(): string;
|
||||
|
||||
/**
|
||||
* @deprecated In ramsey/uuid version 5.0.0, this will be removed from the
|
||||
* interface. It is available at {@see UuidV1::getDateTime()}.
|
||||
|
||||
@@ -87,16 +87,6 @@ trait DeprecatedUuidMethodsTrait
|
||||
return $this->numberConverter->fromHex($this->fields->getClockSeq()->toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@see UuidInterface::getFields()} to get a
|
||||
* {@see FieldsInterface} instance. If it is a {@see Rfc4122FieldsInterface}
|
||||
* instance, you may call {@see Rfc4122FieldsInterface::getClockSeq()}.
|
||||
*/
|
||||
public function getClockSequenceHex(): string
|
||||
{
|
||||
return $this->fields->getClockSeq()->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This method will be removed in 5.0.0. There is no alternative
|
||||
* recommendation, so plan accordingly.
|
||||
|
||||
@@ -148,13 +148,6 @@ final class LazyUuidFromString implements UuidInterface
|
||||
->getFieldsHex();
|
||||
}
|
||||
|
||||
/** @psalm-suppress DeprecatedMethod */
|
||||
public function getClockSequenceHex(): string
|
||||
{
|
||||
return ($this->unwrapped ?? $this->unwrap())
|
||||
->getClockSequenceHex();
|
||||
}
|
||||
|
||||
/** @psalm-suppress DeprecatedMethod */
|
||||
public function getDateTime(): DateTimeInterface
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ use Ramsey\Uuid\Generator\CombGenerator;
|
||||
use Ramsey\Uuid\Generator\DefaultTimeGenerator;
|
||||
use Ramsey\Uuid\Math\BrickMathCalculator;
|
||||
use Ramsey\Uuid\Rfc4122\UuidInterface;
|
||||
use Ramsey\Uuid\Rfc4122\UuidV1;
|
||||
use Ramsey\Uuid\Type\Hexadecimal;
|
||||
use Ramsey\Uuid\Type\Time;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
@@ -135,22 +136,24 @@ class ExpectedBehaviorTest extends TestCase
|
||||
|
||||
public function testUuidVersion1MethodBehavior()
|
||||
{
|
||||
/** @var UuidV1 $uuid */
|
||||
$uuid = Uuid::uuid1('00000fffffff', 0xffff);
|
||||
|
||||
$this->assertInstanceOf('DateTimeInterface', $uuid->getDateTime());
|
||||
$this->assertSame('00000fffffff', $uuid->getNodeHex());
|
||||
$this->assertSame('3fff', $uuid->getClockSequenceHex());
|
||||
$this->assertSame('3fff', $uuid->getFields()->getClockSeq()->toString());
|
||||
$this->assertSame('16383', (string) $uuid->getClockSequence());
|
||||
}
|
||||
|
||||
public function testUuidVersion1MethodBehavior64Bit()
|
||||
{
|
||||
/** @var UuidV1 $uuid */
|
||||
$uuid = Uuid::uuid1('ffffffffffff', 0xffff);
|
||||
|
||||
$this->assertInstanceOf('DateTimeInterface', $uuid->getDateTime());
|
||||
$this->assertSame('ffffffffffff', $uuid->getNodeHex());
|
||||
$this->assertSame('281474976710655', (string) $uuid->getNode());
|
||||
$this->assertSame('3fff', $uuid->getClockSequenceHex());
|
||||
$this->assertSame('3fff', $uuid->getFields()->getClockSeq()->toString());
|
||||
$this->assertSame('16383', (string) $uuid->getClockSequence());
|
||||
$this->assertTrue(ctype_digit((string) $uuid->getTimestamp()));
|
||||
}
|
||||
|
||||
+6
-4
@@ -19,6 +19,7 @@ use Ramsey\Uuid\Generator\RandomGeneratorFactory;
|
||||
use Ramsey\Uuid\Generator\RandomGeneratorInterface;
|
||||
use Ramsey\Uuid\Guid\Guid;
|
||||
use Ramsey\Uuid\Lazy\LazyUuidFromString;
|
||||
use Ramsey\Uuid\Nonstandard\UuidV6;
|
||||
use Ramsey\Uuid\Provider\Node\RandomNodeProvider;
|
||||
use Ramsey\Uuid\Provider\Time\FixedTimeProvider;
|
||||
use Ramsey\Uuid\Rfc4122\FieldsInterface;
|
||||
@@ -181,9 +182,9 @@ class UuidTest extends TestCase
|
||||
|
||||
public function testGetClockSequenceHex(): void
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
/** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertSame('1b21', $uuid->getClockSequenceHex());
|
||||
$this->assertSame('1b21', $uuid->getFields()->getClockSeq()->toString());
|
||||
}
|
||||
|
||||
public function testGetDateTime(): void
|
||||
@@ -636,11 +637,12 @@ class UuidTest extends TestCase
|
||||
|
||||
public function testUuid6WithNodeAndClockSequence(): void
|
||||
{
|
||||
/** @var UuidV6 $uuid */
|
||||
$uuid = Uuid::uuid6(new Hexadecimal('0800200c9a66'), 0x1669);
|
||||
$this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime());
|
||||
$this->assertSame(2, $uuid->getVariant());
|
||||
$this->assertSame(6, $uuid->getVersion());
|
||||
$this->assertSame('1669', $uuid->getClockSequenceHex());
|
||||
$this->assertSame('1669', $uuid->getFields()->getClockSeq()->toString());
|
||||
$this->assertSame('0800200c9a66', $uuid->getNodeHex());
|
||||
$this->assertSame('9669-0800200c9a66', substr($uuid->toString(), 19));
|
||||
}
|
||||
@@ -1226,7 +1228,7 @@ class UuidTest extends TestCase
|
||||
if ($uuid->getVersion() === 1) {
|
||||
$this->assertSame($time, $uuid->getTimestampHex());
|
||||
}
|
||||
$this->assertSame($clockSeq, $uuid->getClockSequenceHex());
|
||||
$this->assertSame($clockSeq, $uuid->getFields()->getClockSeq()->toString());
|
||||
$this->assertSame($variant, $uuid->getVariant());
|
||||
$this->assertSame($version, $uuid->getVersion());
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ final class UuidIsImmutable
|
||||
$a->getNumberConverter(),
|
||||
$a->getHex(),
|
||||
$a->getFieldsHex(),
|
||||
$a->getClockSequenceHex(),
|
||||
$a->getDateTime(),
|
||||
$a->getInteger(),
|
||||
$a->getLeastSignificantBitsHex(),
|
||||
|
||||
Reference in New Issue
Block a user