mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-15 16:07:55 +03:00
Remove remaining deprecated getClockSeq*() methods
This commit is contained in:
@@ -21,8 +21,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
* `Ramsey\Uuid\Generator\RandomLibAdapter`
|
||||
* `Ramsey\Uuid\Provider\Node\NodeProviderCollection`
|
||||
* Remove the following deprecated methods from Uuid classes:
|
||||
* `getClockSeqHiAndReserved()`
|
||||
* `getClockSeqHiAndReservedHex()`
|
||||
* `getClockSeqLow()`
|
||||
* `getClockSeqLowHex()`
|
||||
* `getClockSequence()`
|
||||
* `getClockSequenceHex()`
|
||||
* `getLeastSignificantBits()`
|
||||
* `getLeastSignificantBitsHex()`
|
||||
|
||||
@@ -11,11 +11,6 @@ parameters:
|
||||
message: '#^Comparison operation ">" between 6 and 0 is always true\.$#'
|
||||
count: 1
|
||||
path: ./src/Generator/CombGenerator.php
|
||||
-
|
||||
# Legacy methods of `Ramsey\Uuid` use interface methods that are NOT defined on `FieldsInterface`
|
||||
message: '#^Call to an undefined method Ramsey\\Uuid\\Fields\\FieldsInterface::get.*$#'
|
||||
count: 3
|
||||
path: ./src/Lazy/LazyUuidFromString.php
|
||||
-
|
||||
message: '#^Result of \|\| is always false\.$#'
|
||||
count: 1
|
||||
|
||||
@@ -50,42 +50,6 @@ trait DeprecatedUuidMethodsTrait
|
||||
*/
|
||||
protected $timeConverter;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@see UuidInterface::getFields()} to get a
|
||||
* {@see FieldsInterface} instance. If it is a {@see Rfc4122FieldsInterface}
|
||||
* instance, you may call {@see Rfc4122FieldsInterface::getClockSeqHiAndReserved()}
|
||||
* and use the arbitrary-precision math library of your choice to
|
||||
* convert it to a string integer.
|
||||
*/
|
||||
public function getClockSeqHiAndReserved(): string
|
||||
{
|
||||
return $this->numberConverter->fromHex($this->fields->getClockSeqHiAndReserved()->toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@see UuidInterface::getFields()} to get a
|
||||
* {@see FieldsInterface} instance. If it is a {@see Rfc4122FieldsInterface}
|
||||
* instance, you may call {@see Rfc4122FieldsInterface::getClockSeqLow()}
|
||||
* and use the arbitrary-precision math library of your choice to
|
||||
* convert it to a string integer.
|
||||
*/
|
||||
public function getClockSeqLow(): string
|
||||
{
|
||||
return $this->numberConverter->fromHex($this->fields->getClockSeqLow()->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()}
|
||||
* and use the arbitrary-precision math library of your choice to
|
||||
* convert it to a string integer.
|
||||
*/
|
||||
public function getClockSequence(): string
|
||||
{
|
||||
return $this->numberConverter->fromHex($this->fields->getClockSeq()->toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This method will be removed in 5.0.0. There is no alternative
|
||||
* recommendation, so plan accordingly.
|
||||
|
||||
@@ -236,78 +236,6 @@ final class LazyUuidFromString implements UuidInterface
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@see UuidInterface::getFields()} to get a
|
||||
* {@see FieldsInterface} instance. If it is a {@see Rfc4122FieldsInterface}
|
||||
* instance, you may call {@see Rfc4122FieldsInterface::getClockSeqHiAndReserved()}
|
||||
* and use the arbitrary-precision math library of your choice to
|
||||
* convert it to a string integer.
|
||||
*
|
||||
* @psalm-suppress UndefinedInterfaceMethod
|
||||
* @psalm-suppress DeprecatedMethod
|
||||
* @psalm-suppress MixedArgument
|
||||
* @psalm-suppress MixedMethodCall
|
||||
*/
|
||||
public function getClockSeqHiAndReserved(): string
|
||||
{
|
||||
$instance = ($this->unwrapped ?? $this->unwrap());
|
||||
|
||||
return $instance->getNumberConverter()
|
||||
->fromHex(
|
||||
$instance->getFields()
|
||||
->getClockSeqHiAndReserved()
|
||||
->toString()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@see UuidInterface::getFields()} to get a
|
||||
* {@see FieldsInterface} instance. If it is a {@see Rfc4122FieldsInterface}
|
||||
* instance, you may call {@see Rfc4122FieldsInterface::getClockSeqLow()}
|
||||
* and use the arbitrary-precision math library of your choice to
|
||||
* convert it to a string integer.
|
||||
*
|
||||
* @psalm-suppress UndefinedInterfaceMethod
|
||||
* @psalm-suppress DeprecatedMethod
|
||||
* @psalm-suppress MixedArgument
|
||||
* @psalm-suppress MixedMethodCall
|
||||
*/
|
||||
public function getClockSeqLow(): string
|
||||
{
|
||||
$instance = ($this->unwrapped ?? $this->unwrap());
|
||||
|
||||
return $instance->getNumberConverter()
|
||||
->fromHex(
|
||||
$instance->getFields()
|
||||
->getClockSeqLow()
|
||||
->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()}
|
||||
* and use the arbitrary-precision math library of your choice to
|
||||
* convert it to a string integer.
|
||||
*
|
||||
* @psalm-suppress UndefinedInterfaceMethod
|
||||
* @psalm-suppress DeprecatedMethod
|
||||
* @psalm-suppress MixedArgument
|
||||
* @psalm-suppress MixedMethodCall
|
||||
*/
|
||||
public function getClockSequence(): string
|
||||
{
|
||||
$instance = ($this->unwrapped ?? $this->unwrap());
|
||||
|
||||
return $instance->getNumberConverter()
|
||||
->fromHex(
|
||||
$instance->getFields()
|
||||
->getClockSeq()
|
||||
->toString()
|
||||
);
|
||||
}
|
||||
|
||||
public function toUuidV1(): UuidV1
|
||||
{
|
||||
$instance = ($this->unwrapped ?? $this->unwrap());
|
||||
|
||||
@@ -139,7 +139,6 @@ class ExpectedBehaviorTest extends TestCase
|
||||
$this->assertInstanceOf('DateTimeInterface', $uuid->getDateTime());
|
||||
$this->assertSame('00000fffffff', $uuid->getFields()->getNode()->toString());
|
||||
$this->assertSame('3fff', $uuid->getFields()->getClockSeq()->toString());
|
||||
$this->assertSame('16383', (string) $uuid->getClockSequence());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-23
@@ -145,13 +145,6 @@ class UuidTest extends TestCase
|
||||
$this->assertSame('/2+MsMV9EeGbIQgAIAyaZg==', base64_encode($uuid->getBytes()));
|
||||
}
|
||||
|
||||
public function testGetClockSeqHiAndReserved(): void
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertSame('155', $uuid->getClockSeqHiAndReserved());
|
||||
}
|
||||
|
||||
public function testGetClockSeqHiAndReservedHex(): void
|
||||
{
|
||||
/** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */
|
||||
@@ -159,13 +152,6 @@ class UuidTest extends TestCase
|
||||
$this->assertSame('9b', $uuid->getFields()->getClockSeqHiAndReserved()->toString());
|
||||
}
|
||||
|
||||
public function testGetClockSeqLow(): void
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertSame('33', $uuid->getClockSeqLow());
|
||||
}
|
||||
|
||||
public function testGetClockSeqLowHex(): void
|
||||
{
|
||||
/** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */
|
||||
@@ -173,13 +159,6 @@ class UuidTest extends TestCase
|
||||
$this->assertSame('21', $uuid->getFields()->getClockSeqLow()->toString());
|
||||
}
|
||||
|
||||
public function testGetClockSequence(): void
|
||||
{
|
||||
/** @var Uuid $uuid */
|
||||
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
|
||||
$this->assertSame('6945', $uuid->getClockSequence());
|
||||
}
|
||||
|
||||
public function testGetClockSequenceHex(): void
|
||||
{
|
||||
/** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */
|
||||
@@ -456,7 +435,7 @@ class UuidTest extends TestCase
|
||||
$this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime());
|
||||
$this->assertSame(2, $uuid->getVariant());
|
||||
$this->assertSame(1, $uuid->getVersion());
|
||||
$this->assertSame('5737', $uuid->getClockSequence());
|
||||
$this->assertSame('1669', $uuid->getFields()->getClockSeq()->toString());
|
||||
$this->assertSame('0800200c9a66', $uuid->getFields()->getNode()->toString());
|
||||
$this->assertSame('9669-0800200c9a66', substr($uuid->toString(), 19));
|
||||
}
|
||||
@@ -468,7 +447,7 @@ class UuidTest extends TestCase
|
||||
$this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime());
|
||||
$this->assertSame(2, $uuid->getVariant());
|
||||
$this->assertSame(1, $uuid->getVersion());
|
||||
$this->assertSame('5737', $uuid->getClockSequence());
|
||||
$this->assertSame('1669', $uuid->getFields()->getClockSeq()->toString());
|
||||
$this->assertSame('0800200c9a66', $uuid->getFields()->getNode()->toString());
|
||||
$this->assertSame('9669-0800200c9a66', substr($uuid->toString(), 19));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user