Merge branch '5.1' into 5.2

* 5.1:
  [Uid] Hardcode UuidV3 & UuidV5 TYPE conditional constants
  [Uid] Use the Uuid constructor when reconstructing an Ulid from its RFC-4122 version
  stop using void in test files
This commit is contained in:
Christian Flothmann 2021-01-05 20:21:40 +01:00
commit bc20e633f3
8 changed files with 9 additions and 9 deletions

View File

@ -77,7 +77,7 @@ class NumberTypeTest extends BaseTypeTest
$this->assertSame('12345,68', $form->createView()->vars['value']);
}
public function testStringInputWithFloatData(): void
public function testStringInputWithFloatData()
{
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$this->expectExceptionMessage('Expected a numeric string.');
@ -88,7 +88,7 @@ class NumberTypeTest extends BaseTypeTest
]);
}
public function testStringInputWithIntData(): void
public function testStringInputWithIntData()
{
$this->expectException('Symfony\Component\Form\Exception\TransformationFailedException');
$this->expectExceptionMessage('Expected a numeric string.');

View File

@ -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()
{

View File

@ -59,7 +59,7 @@ class Ulid extends AbstractUid
public static function fromString(string $ulid): parent
{
if (36 === \strlen($ulid) && Uuid::isValid($ulid)) {
$ulid = Uuid::fromString($ulid)->toBinary();
$ulid = (new Uuid($ulid))->toBinary();
} elseif (22 === \strlen($ulid) && 22 === strspn($ulid, BinaryUtil::BASE58[''])) {
$ulid = BinaryUtil::fromBase($ulid, BinaryUtil::BASE58);
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -22,5 +22,5 @@ namespace Symfony\Component\Uid;
*/
class UuidV3 extends Uuid
{
protected const TYPE = \UUID_TYPE_MD5;
protected const TYPE = 3;
}

View File

@ -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)
{

View File

@ -22,5 +22,5 @@ namespace Symfony\Component\Uid;
*/
class UuidV5 extends Uuid
{
protected const TYPE = \UUID_TYPE_SHA1;
protected const TYPE = 5;
}