Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Uid] use one class per type of UUID#36066

Merged
nicolas-grekas merged 1 commit into
symfony:mastersymfony/symfony:masterfrom
nicolas-grekas:uuid-classesnicolas-grekas/symfony:uuid-classesCopy head branch name to clipboard
Mar 14, 2020
Merged

[Uid] use one class per type of UUID#36066
nicolas-grekas merged 1 commit into
symfony:mastersymfony/symfony:masterfrom
nicolas-grekas:uuid-classesnicolas-grekas/symfony:uuid-classesCopy head branch name to clipboard

Conversation

@nicolas-grekas
Copy link
Copy Markdown
Member

@nicolas-grekas nicolas-grekas commented Mar 13, 2020

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

(embeds #36064 for now)

Would it make sense to have one class per type of UUID?
This aligns the type system and UUID types, so that one could type hint e.g. UuidV4 $uuid.

This PR does so. UuidV1/2/3/4 and NullUuid all extend the base Uuid class, which provides common methods and the factories needed to create each king of UUID.

This means we don't need the getType() nor the isNull() methods since they can be replaced by instanceof checks.

As expected, getTime() and getMac() then now exist only on the UuidV1 class - no need for any version check nor any LogicException anymore.

Each type is guaranteed to contain a UUID that matches its class' type. The base Uuid class is used for the "no type" type.

@nicolas-grekas nicolas-grekas added this to the next milestone Mar 13, 2020
@nicolas-grekas nicolas-grekas requested a review from lyrixx March 13, 2020 20:33
@nicolas-grekas nicolas-grekas force-pushed the uuid-classes branch 2 times, most recently from 029531a to 5f6a725 Compare March 13, 2020 20:43
Comment thread src/Symfony/Component/Uid/UuidV1.php
@nicolas-grekas nicolas-grekas force-pushed the uuid-classes branch 2 times, most recently from 96561be to 8441fb0 Compare March 13, 2020 21:22
Comment thread src/Symfony/Component/Uid/Uuid.php
@fabpot
Copy link
Copy Markdown
Member

fabpot commented Mar 14, 2020

#36064 has been merged now.

@nicolas-grekas
Copy link
Copy Markdown
Member Author

thanks, rebased

@nicolas-grekas nicolas-grekas merged commit 7dc6da6 into symfony:master Mar 14, 2020
@nicolas-grekas nicolas-grekas deleted the uuid-classes branch March 14, 2020 13:56
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
@fabpot fabpot mentioned this pull request May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.