diff --git a/CHANGELOG.md b/CHANGELOG.md index d922c45..383969c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * `Ramsey\Uuid\Provider\Node\NodeProviderCollection` * Remove the following deprecated methods from Uuid classes: * `getClockSeqHiAndReservedHex()` + * `getClockSeqLowHex()` * Remove dependency on ramsey/collection package. diff --git a/src/DeprecatedUuidInterface.php b/src/DeprecatedUuidInterface.php index 3c502c2..36bb2e4 100644 --- a/src/DeprecatedUuidInterface.php +++ b/src/DeprecatedUuidInterface.php @@ -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::getClockSeqLow()}. - */ - public function getClockSeqLowHex(): string; - /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a diff --git a/src/DeprecatedUuidMethodsTrait.php b/src/DeprecatedUuidMethodsTrait.php index 470b666..5af30f8 100644 --- a/src/DeprecatedUuidMethodsTrait.php +++ b/src/DeprecatedUuidMethodsTrait.php @@ -75,16 +75,6 @@ trait DeprecatedUuidMethodsTrait 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::getClockSeqLow()}. - */ - public function getClockSeqLowHex(): string - { - return $this->fields->getClockSeqLow()->toString(); - } - /** * @deprecated Use {@see UuidInterface::getFields()} to get a * {@see FieldsInterface} instance. If it is a {@see Rfc4122FieldsInterface} diff --git a/src/Lazy/LazyUuidFromString.php b/src/Lazy/LazyUuidFromString.php index cddabbc..1dd0b65 100644 --- a/src/Lazy/LazyUuidFromString.php +++ b/src/Lazy/LazyUuidFromString.php @@ -148,13 +148,6 @@ final class LazyUuidFromString implements UuidInterface ->getFieldsHex(); } - /** @psalm-suppress DeprecatedMethod */ - public function getClockSeqLowHex(): string - { - return ($this->unwrapped ?? $this->unwrap()) - ->getClockSeqLowHex(); - } - /** @psalm-suppress DeprecatedMethod */ public function getClockSequenceHex(): string { diff --git a/tests/ExpectedBehaviorTest.php b/tests/ExpectedBehaviorTest.php index c2d8696..39dbb81 100644 --- a/tests/ExpectedBehaviorTest.php +++ b/tests/ExpectedBehaviorTest.php @@ -55,14 +55,12 @@ class ExpectedBehaviorTest extends TestCase $this->assertIsString($uuid->getTimeLowHex()); $this->assertIsString($uuid->getTimeMidHex()); $this->assertIsString($uuid->getTimeHiAndVersionHex()); - $this->assertIsString($uuid->getFields()->getClockSeqHiAndReserved()->toString()); - $this->assertIsString($uuid->getClockSeqLowHex()); $this->assertIsString($uuid->getNodeHex()); $this->assertSame($uuid->getFieldsHex()['time_low'], $uuid->getTimeLowHex()); $this->assertSame($uuid->getFieldsHex()['time_mid'], $uuid->getTimeMidHex()); $this->assertSame($uuid->getFieldsHex()['time_hi_and_version'], $uuid->getTimeHiAndVersionHex()); $this->assertSame($uuid->getFieldsHex()['clock_seq_hi_and_reserved'], $uuid->getFields()->getClockSeqHiAndReserved()->toString()); - $this->assertSame($uuid->getFieldsHex()['clock_seq_low'], $uuid->getClockSeqLowHex()); + $this->assertSame($uuid->getFieldsHex()['clock_seq_low'], $uuid->getFields()->getClockSeqLow()->toString()); $this->assertSame($uuid->getFieldsHex()['node'], $uuid->getNodeHex()); $this->assertSame(substr((string) $uuid->getHex(), 16), $uuid->getLeastSignificantBitsHex()); $this->assertSame(substr((string) $uuid->getHex(), 0, 16), $uuid->getMostSignificantBitsHex()); @@ -73,7 +71,7 @@ class ExpectedBehaviorTest extends TestCase . $uuid->getTimeMidHex() . $uuid->getTimeHiAndVersionHex() . $uuid->getFields()->getClockSeqHiAndReserved()->toString() - . $uuid->getClockSeqLowHex() + . $uuid->getFields()->getClockSeqLow()->toString() . $uuid->getNodeHex() ); @@ -99,7 +97,7 @@ class ExpectedBehaviorTest extends TestCase . $uuid->getTimeMidHex() . '-' . $uuid->getTimeHiAndVersionHex() . '-' . $uuid->getFields()->getClockSeqHiAndReserved()->toString() - . $uuid->getClockSeqLowHex() . '-' + . $uuid->getFields()->getClockSeqLow()->toString() . '-' . $uuid->getNodeHex() ); @@ -109,7 +107,7 @@ class ExpectedBehaviorTest extends TestCase . $uuid->getTimeMidHex() . '-' . $uuid->getTimeHiAndVersionHex() . '-' . $uuid->getFields()->getClockSeqHiAndReserved()->toString() - . $uuid->getClockSeqLowHex() . '-' + . $uuid->getFields()->getClockSeqLow()->toString() . '-' . $uuid->getNodeHex() ); @@ -255,7 +253,11 @@ class ExpectedBehaviorTest extends TestCase $this->assertSame($components[0], $uuid->getTimeLowHex()); $this->assertSame($components[1], $uuid->getTimeMidHex()); $this->assertSame($components[2], $uuid->getTimeHiAndVersionHex()); - $this->assertSame($components[3], $uuid->getFields()->getClockSeqHiAndReserved()->toString() . $uuid->getClockSeqLowHex()); + $this->assertSame( + $components[3], + $uuid->getFields()->getClockSeqHiAndReserved()->toString() + . $uuid->getFields()->getClockSeqLow()->toString(), + ); $this->assertSame($components[4], $uuid->getNodeHex()); $this->assertSame($integer, (string) $uuid->getInteger()); $this->assertSame($bytes, $uuid->getBytes()); @@ -281,7 +283,11 @@ class ExpectedBehaviorTest extends TestCase $this->assertSame($components[0], $uuid->getTimeLowHex()); $this->assertSame($components[1], $uuid->getTimeMidHex()); $this->assertSame($components[2], $uuid->getTimeHiAndVersionHex()); - $this->assertSame($components[3], $uuid->getFields()->getClockSeqHiAndReserved()->toString() . $uuid->getClockSeqLowHex()); + $this->assertSame( + $components[3], + $uuid->getFields()->getClockSeqHiAndReserved()->toString() + . $uuid->getFields()->getClockSeqLow()->toString(), + ); $this->assertSame($components[4], $uuid->getNodeHex()); $this->assertSame($integer, (string) $uuid->getInteger()); $this->assertSame($bytes, $uuid->getBytes()); @@ -307,7 +313,11 @@ class ExpectedBehaviorTest extends TestCase $this->assertSame($components[0], $uuid->getTimeLowHex()); $this->assertSame($components[1], $uuid->getTimeMidHex()); $this->assertSame($components[2], $uuid->getTimeHiAndVersionHex()); - $this->assertSame($components[3], $uuid->getFields()->getClockSeqHiAndReserved()->toString() . $uuid->getClockSeqLowHex()); + $this->assertSame( + $components[3], + $uuid->getFields()->getClockSeqHiAndReserved()->toString() + . $uuid->getFields()->getClockSeqLow()->toString(), + ); $this->assertSame($components[4], $uuid->getNodeHex()); $this->assertSame($integer, (string) $uuid->getInteger()); $this->assertSame($bytes, $uuid->getBytes()); diff --git a/tests/UuidTest.php b/tests/UuidTest.php index c884f7d..bbddc23 100644 --- a/tests/UuidTest.php +++ b/tests/UuidTest.php @@ -167,9 +167,9 @@ class UuidTest extends TestCase public function testGetClockSeqLowHex(): void { - /** @var Uuid $uuid */ + /** @var \Ramsey\Uuid\Rfc4122\UuidInterface $uuid */ $uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66'); - $this->assertSame('21', $uuid->getClockSeqLowHex()); + $this->assertSame('21', $uuid->getFields()->getClockSeqLow()->toString()); } public function testGetClockSequence(): void @@ -1217,7 +1217,10 @@ class UuidTest extends TestCase $fields['clock_seq_hi_and_reserved'], $uuid->getFields()->getClockSeqHiAndReserved()->toString(), ); - $this->assertSame($fields['clock_seq_low'], $uuid->getClockSeqLowHex()); + $this->assertSame( + $fields['clock_seq_low'], + $uuid->getFields()->getClockSeqLow()->toString(), + ); $this->assertSame($fields['node'], $uuid->getNodeHex()); $this->assertSame($urn, $uuid->getUrn()); if ($uuid->getVersion() === 1) { diff --git a/tests/static-analysis/UuidIsImmutable.php b/tests/static-analysis/UuidIsImmutable.php index 9245eb9..cb462a0 100644 --- a/tests/static-analysis/UuidIsImmutable.php +++ b/tests/static-analysis/UuidIsImmutable.php @@ -54,7 +54,6 @@ final class UuidIsImmutable $a->getNumberConverter(), $a->getHex(), $a->getFieldsHex(), - $a->getClockSeqLowHex(), $a->getClockSequenceHex(), $a->getDateTime(), $a->getInteger(),