uuid: [4.1.0] UuidV1::fromString(...) is not instance of UuidV1 anymore - breaking change?
Describe the bug
Using the following code I was able to check whether $uuidString
is a v1 UUID,
$validV1 = UuidV1::fromString('08a527be-8e7a-11e9-bc42-526af7764f64') instanceof UuidV1;
Now it returns false, so:
- maybe it wasn’t the best option to check it - how would you do it in 4.1?
- regardless whether it’s best or not solution - it looks like a breaking change which shouldn’t happen in minor release
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 19 (13 by maintainers)
Related to OP’s issue, I’d like to point out that the page for upgrading version 3 to 4 claims that
Uuid::fromString
returns one of the more specific types, which it doesn’t. This was what I was relying on and why I chose the same approach as OP - which ofc now backfired. Might wanna add a correction to that page if this is gonna stay this way, before somebody else stumbles over this too.Yup, also there, it is documented as
UuidInterface
:@ramsey yeah, I think there needs to be a bit of a harder split between the userland API (
UuidInterface
consumers) and advanced users (people that introspect the UUIDs post-instantiation)Indeed, annoying:
FieldsInterface
seems to be completely useless.https://github.com/ramsey/uuid/blob/69b3eb8824546bf2c06211fcf2ef630effa5ec49/src/Fields/FieldsInterface.php#L26-L32
I think what you posted above makes sense, even if it is indeed a very ugly API: