In version 4, static methods on the Uuid class return more specific types that implement Rfc4122\UuidInterface (which in turn implements UuidInterface).
If your code uses UuidInterface as a type hint, no changes are required.
However, if you type-hint specifically for the Uuid class, you may need to update your code. The following mapping applies:
| Method | 3.x Returned | 4.x Returns |
|---|
Uuid::uuid1() | Uuid | Rfc4122\UuidV1 |
Uuid::uuid3() | Uuid | Rfc4122\UuidV3 |
Uuid::uuid4() | Uuid | Rfc4122\UuidV4 |
Uuid::uuid5() | Uuid | Rfc4122\UuidV5 |
Additionally, Uuid::fromString(), Uuid::fromBytes(), and Uuid::fromInteger() now return specific instances based on the input (e.g., a version 1 UUID returns an Rfc4122\UuidV1). If the input is a valid 128-bit number but not a valid RFC 4122 UUID, it returns Nonstandard\Uuid.