Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit77bcded

Browse files
committed
minor#60530 [Uid] Remove InvalidU*idException in favor of InvalidArgumentException (nicolas-grekas)
This PR was merged into the 7.3 branch.Discussion----------[Uid] Remove InvalidU*idException in favor of InvalidArgumentException| Q | A| ------------- | ---| Branch? | 7.3| Bug fix? | no| New feature? | no| Deprecations? | no| Issues |Fix#60328| License | MITAs discussed in#60328Commits-------9fbc6a4 [Uid] Remove InvalidU*idException in favor of InvalidArgumentException
2 parentsf3247fd +9fbc6a4 commit77bcded

File tree

5 files changed

+5
-49
lines changed

5 files changed

+5
-49
lines changed

‎src/Symfony/Component/Uid/Exception/InvalidUlidException.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

‎src/Symfony/Component/Uid/Exception/InvalidUuidException.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

‎src/Symfony/Component/Uid/Tests/UlidTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
usePHPUnit\Framework\TestCase;
1515
useSymfony\Component\Uid\Exception\InvalidArgumentException;
16-
useSymfony\Component\Uid\Exception\InvalidUlidException;
1716
useSymfony\Component\Uid\MaxUlid;
1817
useSymfony\Component\Uid\NilUlid;
1918
useSymfony\Component\Uid\Tests\Fixtures\CustomUlid;
@@ -43,7 +42,7 @@ public function testGenerate()
4342

4443
publicfunctiontestWithInvalidUlid()
4544
{
46-
$this->expectException(InvalidUlidException::class);
45+
$this->expectException(InvalidArgumentException::class);
4746
$this->expectExceptionMessage('Invalid ULID: "this is not a ulid".');
4847

4948
newUlid('this is not a ulid');

‎src/Symfony/Component/Uid/Ulid.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespaceSymfony\Component\Uid;
1313

1414
useSymfony\Component\Uid\Exception\InvalidArgumentException;
15-
useSymfony\Component\Uid\Exception\InvalidUlidException;
1615

1716
/**
1817
* A ULID is lexicographically sortable and contains a 48-bit timestamp and 80-bit of crypto-random entropy.
@@ -39,7 +38,7 @@ public function __construct(?string $ulid = null)
3938
$this->uid =$ulid;
4039
}else {
4140
if (!self::isValid($ulid)) {
42-
thrownewInvalidUlidException($ulid);
41+
thrownewInvalidArgumentException(\sprintf('Invalid ULID: "%s".',$ulid));
4342
}
4443

4544
$this->uid =strtoupper($ulid);

‎src/Symfony/Component/Uid/Uuid.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespaceSymfony\Component\Uid;
1313

14-
useSymfony\Component\Uid\Exception\InvalidUuidException;
14+
useSymfony\Component\Uid\Exception\InvalidArgumentException;
1515

1616
/**
1717
* @author Grégoire Pineau <lyrixx@lyrixx.info>
@@ -41,13 +41,13 @@ public function __construct(string $uuid, bool $checkVariant = false)
4141
$type =preg_match('{^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$}Di',$uuid) ? (int)$uuid[14] :false;
4242

4343
if (false ===$type || (static::TYPE ?:$type) !==$type) {
44-
thrownewInvalidUuidException(static::TYPE,$uuid);
44+
thrownewInvalidArgumentException(\sprintf('Invalid UUID%s: "%s".',static::TYPE ?'v'.static::TYPE :'',$uuid));
4545
}
4646

4747
$this->uid =strtolower($uuid);
4848

4949
if ($checkVariant && !\in_array($this->uid[19], ['8','9','a','b'],true)) {
50-
thrownewInvalidUuidException(static::TYPE,$uuid);
50+
thrownewInvalidArgumentException(\sprintf('Invalid UUID%s: "%s".',static::TYPE ?'v'.static::TYPE :'',$uuid));
5151
}
5252
}
5353

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp