Change UuidInterface::getInteger() to always return a string value

This commit is contained in:
Ben Ramsey
2019-12-27 12:23:44 -05:00
parent b7f9dc5010
commit ffc400e009
3 changed files with 6 additions and 4 deletions
+4
View File
@@ -42,6 +42,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* Introduce `TimeConverterInterface $timeConverter` as fourth required
constructor parameter for `Uuid` and second required constructor parameter for
`Builder\DefaultUuidBuilder` and `Builder\DegradedUuidBuilder`.
* Change `UuidInterface::getInteger()` to always return a `string` value instead
of `mixed`. This is a string representation of a 128-bit integer. You may then
use a math library of your choice (bcmath, gmp, etc.) to operate on the
string integer.
* Change methods in converter interfaces to accept and return string values
instead of `mixed`; this simplifies the interface and makes it consistent:
* `NumberConverterInterface::fromHex(string $hex): string`
+1 -1
View File
@@ -419,7 +419,7 @@ class Uuid implements UuidInterface
*
* @inheritDoc
*/
public function getInteger()
public function getInteger(): string
{
return $this->numberConverter->fromHex($this->getHex());
}
+1 -3
View File
@@ -130,10 +130,8 @@ interface UuidInterface extends JsonSerializable, Serializable
/**
* Returns the 128-bit integer value of the UUID as a string
*
* @return string
*/
public function getInteger();
public function getInteger(): string;
/**
* Returns the least significant 64 bits of the UUID