diff --git a/CHANGELOG.md b/CHANGELOG.md index ca27e51..9a0529b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * `getClockSeqHiAndReservedHex()` * `getClockSeqLowHex()` * `getClockSequenceHex()` + * `getLeastSignificantBits()` + * `getLeastSignificantBitsHex()` * Remove dependency on ramsey/collection package. diff --git a/src/DeprecatedUuidInterface.php b/src/DeprecatedUuidInterface.php index 42b063f..ade9759 100644 --- a/src/DeprecatedUuidInterface.php +++ b/src/DeprecatedUuidInterface.php @@ -45,13 +45,6 @@ interface DeprecatedUuidInterface */ public function getDateTime(): DateTimeInterface; - /** - * @deprecated This method will be removed in 5.0.0. There is no direct - * alternative, but the same information may be obtained by splitting - * in half the value returned by {@see UuidInterface::getHex()}. - */ - public function getLeastSignificantBitsHex(): string; - /** * @deprecated This method will be removed in 5.0.0. There is no direct * alternative, but the same information may be obtained by splitting diff --git a/src/DeprecatedUuidMethodsTrait.php b/src/DeprecatedUuidMethodsTrait.php index e84f210..7f071ce 100644 --- a/src/DeprecatedUuidMethodsTrait.php +++ b/src/DeprecatedUuidMethodsTrait.php @@ -143,28 +143,6 @@ trait DeprecatedUuidMethodsTrait ]; } - /** - * @deprecated This method will be removed in 5.0.0. There is no direct - * alternative, but the same information may be obtained by splitting - * in half the value returned by {@see UuidInterface::getHex()}. - */ - public function getLeastSignificantBits(): string - { - $leastSignificantHex = substr($this->getHex()->toString(), 16); - - return $this->numberConverter->fromHex($leastSignificantHex); - } - - /** - * @deprecated This method will be removed in 5.0.0. There is no direct - * alternative, but the same information may be obtained by splitting - * in half the value returned by {@see UuidInterface::getHex()}. - */ - public function getLeastSignificantBitsHex(): string - { - return substr($this->getHex()->toString(), 16); - } - /** * @deprecated This method will be removed in 5.0.0. There is no direct * alternative, but the same information may be obtained by splitting diff --git a/src/Lazy/LazyUuidFromString.php b/src/Lazy/LazyUuidFromString.php index fe99fa3..017a02d 100644 --- a/src/Lazy/LazyUuidFromString.php +++ b/src/Lazy/LazyUuidFromString.php @@ -155,13 +155,6 @@ final class LazyUuidFromString implements UuidInterface ->getDateTime(); } - /** @psalm-suppress DeprecatedMethod */ - public function getLeastSignificantBitsHex(): string - { - return ($this->unwrapped ?? $this->unwrap()) - ->getLeastSignificantBitsHex(); - } - /** @psalm-suppress DeprecatedMethod */ public function getMostSignificantBitsHex(): string { @@ -358,24 +351,6 @@ final class LazyUuidFromString implements UuidInterface ); } - /** - * @deprecated This method will be removed in 5.0.0. There is no direct - * alternative, but the same information may be obtained by splitting - * in half the value returned by {@see UuidInterface::getHex()}. - * - * @psalm-suppress UndefinedInterfaceMethod - * @psalm-suppress DeprecatedMethod - * @psalm-suppress MixedArgument - * @psalm-suppress MixedMethodCall - */ - public function getLeastSignificantBits(): string - { - $instance = ($this->unwrapped ?? $this->unwrap()); - - return $instance->getNumberConverter() - ->fromHex(substr($instance->getHex()->toString(), 16)); - } - /** * @deprecated This method will be removed in 5.0.0. There is no direct * alternative, but the same information may be obtained by splitting diff --git a/tests/ExpectedBehaviorTest.php b/tests/ExpectedBehaviorTest.php index 319db37..71bfc50 100644 --- a/tests/ExpectedBehaviorTest.php +++ b/tests/ExpectedBehaviorTest.php @@ -63,7 +63,6 @@ class ExpectedBehaviorTest extends TestCase $this->assertSame($uuid->getFieldsHex()['clock_seq_hi_and_reserved'], $uuid->getFields()->getClockSeqHiAndReserved()->toString()); $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()); $this->assertSame( diff --git a/tests/UuidTest.php b/tests/UuidTest.php index 60a4103..7d80677 100644 --- a/tests/UuidTest.php +++ b/tests/UuidTest.php @@ -304,21 +304,6 @@ class UuidTest extends TestCase $this->assertSame($fields, $uuid->getFieldsHex()); } - public function testGetLeastSignificantBits(): void - { - /** @var Uuid $uuid */ - $uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66'); - - $this->assertSame('11178224546741000806', $uuid->getLeastSignificantBits()); - } - - public function testGetLeastSignificantBitsHex(): void - { - $uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66'); - - $this->assertSame('9b210800200c9a66', $uuid->getLeastSignificantBitsHex()); - } - public function testGetMostSignificantBits(): void { /** @var Uuid $uuid */ diff --git a/tests/static-analysis/UuidIsImmutable.php b/tests/static-analysis/UuidIsImmutable.php index c22b616..ef460fe 100644 --- a/tests/static-analysis/UuidIsImmutable.php +++ b/tests/static-analysis/UuidIsImmutable.php @@ -56,7 +56,6 @@ final class UuidIsImmutable $a->getFieldsHex(), $a->getDateTime(), $a->getInteger(), - $a->getLeastSignificantBitsHex(), $a->getMostSignificantBitsHex(), $a->getNodeHex(), $a->getTimeHiAndVersionHex(),