mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-14 15:56:48 +03:00
Marking Uuid::uuid3() as pure as well: it produces same values for same input
This commit is contained in:
@@ -512,6 +512,9 @@ class Uuid implements UuidInterface
|
||||
*
|
||||
* @return UuidInterface A UuidInterface instance that represents a
|
||||
* version 3 UUID
|
||||
*
|
||||
* @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants,
|
||||
* but under constant factory setups, this method operates in functionally pure manners
|
||||
*/
|
||||
public static function uuid3($ns, string $name): UuidInterface
|
||||
{
|
||||
|
||||
@@ -90,6 +90,15 @@ final class UuidIsImmutable
|
||||
];
|
||||
}
|
||||
|
||||
/** @psalm-pure */
|
||||
public static function uuid3IsPure(): UuidInterface
|
||||
{
|
||||
return Uuid::uuid3(
|
||||
Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66'),
|
||||
'Look ma! I am a pure function!'
|
||||
);
|
||||
}
|
||||
|
||||
/** @psalm-pure */
|
||||
public static function uuid5IsPure(): UuidInterface
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user