minor #39730 [Uid] Inline UuidV*::TYPE constants (fancyweb)
This PR was merged into the 5.1 branch.
Discussion
----------
[Uid] Inline UuidV*::TYPE constants
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Ref https://github.com/symfony/polyfill/issues/323
If we hardcode those values in the polyfill, we can surely hardcode them here? In my case, I have tested that `uuid_type` actually returns `3` even if the `\UUID_TYPE_MD5` constant is undefined 🤷♂️
Commits
-------
f0fafec019
[Uid] Hardcode UuidV3 & UuidV5 TYPE conditional constants
This commit is contained in:
commit
6a953f4927
@ -18,7 +18,7 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class NilUuid extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_NULL;
|
||||
protected const TYPE = -1;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class Uuid extends AbstractUid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_DEFAULT;
|
||||
protected const TYPE = 0;
|
||||
|
||||
public function __construct(string $uuid)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class UuidV1 extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_TIME;
|
||||
protected const TYPE = 1;
|
||||
|
||||
public function __construct(string $uuid = null)
|
||||
{
|
||||
|
@ -22,5 +22,5 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class UuidV3 extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_MD5;
|
||||
protected const TYPE = 3;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class UuidV4 extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_RANDOM;
|
||||
protected const TYPE = 4;
|
||||
|
||||
public function __construct(string $uuid = null)
|
||||
{
|
||||
|
@ -22,5 +22,5 @@ namespace Symfony\Component\Uid;
|
||||
*/
|
||||
class UuidV5 extends Uuid
|
||||
{
|
||||
protected const TYPE = \UUID_TYPE_SHA1;
|
||||
protected const TYPE = 5;
|
||||
}
|
||||
|
Reference in New Issue
Block a user