mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-15 16:07:55 +03:00
Change UuidInterface::getInteger() to always return a string value
This commit is contained in:
@@ -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
@@ -419,7 +419,7 @@ class Uuid implements UuidInterface
|
||||
*
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getInteger()
|
||||
public function getInteger(): string
|
||||
{
|
||||
return $this->numberConverter->fromHex($this->getHex());
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user