← All changes
|
includes/sdk/google/ramsey/uuid/src/UuidInterface.php
+41
-32
1.0.3
→
1.4.2
View file →
| @@ -9,78 +9,87 @@ | ||
| 9 | 9 | * @copyright Copyright (c) Ben Ramsey <[email protected]> |
| 10 | 10 | * @license http://opensource.org/licenses/MIT MIT |
| 11 | 11 | */ |
| 12 | 12 | declare (strict_types=1); |
| 13 | -namespace Dudlewebs\WPMCS\Ramsey\Uuid; | |
| 13 | +namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid; | |
| 14 | 14 | |
| 15 | 15 | use JsonSerializable; |
| 16 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Fields\FieldsInterface; | |
| 17 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Hexadecimal; | |
| 18 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Integer as IntegerObject; | |
| 16 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Fields\FieldsInterface; | |
| 17 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Type\Hexadecimal; | |
| 18 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Type\Integer as IntegerObject; | |
| 19 | 19 | use Serializable; |
| 20 | +use Stringable; | |
| 20 | 21 | /** |
| 21 | - * A UUID is a universally unique identifier adhering to an agreed-upon | |
| 22 | - * representation format and standard for generation | |
| 22 | + * A UUID is a universally unique identifier adhering to an agreed-upon representation format and standard for generation | |
| 23 | 23 | * |
| 24 | - * @psalm-immutable | |
| 24 | + * @immutable | |
| 25 | 25 | */ |
| 26 | -interface UuidInterface extends DeprecatedUuidInterface, JsonSerializable, Serializable | |
| 26 | +interface UuidInterface extends DeprecatedUuidInterface, JsonSerializable, Serializable, Stringable | |
| 27 | 27 | { |
| 28 | 28 | /** |
| 29 | - * Returns -1, 0, or 1 if the UUID is less than, equal to, or greater than | |
| 30 | - * the other UUID | |
| 29 | + * Returns -1, 0, or 1 if the UUID is less than, equal to, or greater than the other UUID | |
| 31 | 30 | * |
| 32 | - * The first of two UUIDs is greater than the second if the most | |
| 33 | - * significant field in which the UUIDs differ is greater for the first | |
| 34 | - * UUID. | |
| 31 | + * The first of two UUIDs is greater than the second if the most significant field in which the UUIDs differ is | |
| 32 | + * greater for the first UUID. | |
| 35 | 33 | * |
| 36 | - * * Q. What's the value of being able to sort UUIDs? | |
| 37 | - * * A. Use them as keys in a B-Tree or similar mapping. | |
| 38 | - * | |
| 39 | 34 | * @param UuidInterface $other The UUID to compare |
| 40 | 35 | * |
| 41 | - * @return int -1, 0, or 1 if the UUID is less than, equal to, or greater than $other | |
| 36 | + * @return int<-1,1> -1, 0, or 1 if the UUID is less than, equal to, or greater than $other | |
| 42 | 37 | */ |
| 43 | - public function compareTo(UuidInterface $other): int; | |
| 38 | + public function compareTo(UuidInterface $other) : int; | |
| 44 | 39 | /** |
| 45 | 40 | * Returns true if the UUID is equal to the provided object |
| 46 | 41 | * |
| 47 | - * The result is true if and only if the argument is not null, is a UUID | |
| 48 | - * object, has the same variant, and contains the same value, bit for bit, | |
| 49 | - * as the UUID. | |
| 42 | + * The result is true if and only if the argument is not null, is a UUID object, has the same variant, and contains | |
| 43 | + * the same value, bit-for-bit, as the UUID. | |
| 50 | 44 | * |
| 51 | - * @param object|null $other An object to test for equality with this UUID | |
| 45 | + * @param object | null $other An object to test for equality with this UUID | |
| 52 | 46 | * |
| 53 | 47 | * @return bool True if the other object is equal to this UUID |
| 54 | 48 | */ |
| 55 | - public function equals(?object $other): bool; | |
| 49 | + public function equals(?object $other) : bool; | |
| 56 | 50 | /** |
| 57 | 51 | * Returns the binary string representation of the UUID |
| 58 | 52 | * |
| 59 | - * @psalm-return non-empty-string | |
| 53 | + * @return non-empty-string | |
| 54 | + * | |
| 55 | + * @pure | |
| 60 | 56 | */ |
| 61 | - public function getBytes(): string; | |
| 57 | + public function getBytes() : string; | |
| 62 | 58 | /** |
| 63 | 59 | * Returns the fields that comprise this UUID |
| 64 | 60 | */ |
| 65 | - public function getFields(): FieldsInterface; | |
| 61 | + public function getFields() : FieldsInterface; | |
| 66 | 62 | /** |
| 67 | 63 | * Returns the hexadecimal representation of the UUID |
| 68 | 64 | */ |
| 69 | - public function getHex(): Hexadecimal; | |
| 65 | + public function getHex() : Hexadecimal; | |
| 70 | 66 | /** |
| 71 | 67 | * Returns the integer representation of the UUID |
| 72 | 68 | */ |
| 73 | - public function getInteger(): IntegerObject; | |
| 69 | + public function getInteger() : IntegerObject; | |
| 74 | 70 | /** |
| 71 | + * Returns the string standard representation of the UUID as a URN | |
| 72 | + * | |
| 73 | + * @link http://en.wikipedia.org/wiki/Uniform_Resource_Name Uniform Resource Name | |
| 74 | + * @link https://www.rfc-editor.org/rfc/rfc9562.html#section-4 RFC 9562, 4. UUID Format | |
| 75 | + * @link https://www.rfc-editor.org/rfc/rfc9562.html#section-7 RFC 9562, 7. IANA Considerations | |
| 76 | + * @link https://www.rfc-editor.org/rfc/rfc4122.html#section-3 RFC 4122, 3. Namespace Registration Template | |
| 77 | + */ | |
| 78 | + public function getUrn() : string; | |
| 79 | + /** | |
| 75 | 80 | * Returns the string standard representation of the UUID |
| 76 | 81 | * |
| 77 | - * @psalm-return non-empty-string | |
| 82 | + * @return non-empty-string | |
| 83 | + * | |
| 84 | + * @pure | |
| 78 | 85 | */ |
| 79 | - public function toString(): string; | |
| 86 | + public function toString() : string; | |
| 80 | 87 | /** |
| 81 | 88 | * Casts the UUID to the string standard representation |
| 82 | 89 | * |
| 83 | - * @psalm-return non-empty-string | |
| 90 | + * @return non-empty-string | |
| 91 | + * | |
| 92 | + * @pure | |
| 84 | 93 | */ |
| 85 | - public function __toString(): string; | |
| 94 | + public function __toString() : string; | |
| 86 | 95 | } |