Skip to content

Commit b5c9440

Browse files
feat: Rename BlockFailedException to AlreadyBlockedException
1 parent 6e02db4 commit b5c9440

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/Blocker.php

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

1414
namespace Brainbits\Blocking;
1515

16-
use Brainbits\Blocking\Exception\BlockFailedException;
16+
use Brainbits\Blocking\Exception\AlreadyBlockedException;
1717
use Brainbits\Blocking\Identity\BlockIdentity;
1818
use Brainbits\Blocking\Owner\OwnerFactoryInterface;
1919
use Brainbits\Blocking\Storage\StorageInterface;
@@ -32,7 +32,7 @@ public function block(BlockIdentity $identifier, int|null $ttl = null): Block
3232
$block = $this->tryBlock($identifier, $ttl);
3333

3434
if ($block === null) {
35-
throw BlockFailedException::createAlreadyBlocked($identifier);
35+
throw AlreadyBlockedException::createAlreadyBlocked($identifier);
3636
}
3737

3838
return $block;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
use function sprintf;
1919

20-
class BlockFailedException extends RuntimeException
20+
class AlreadyBlockedException extends RuntimeException
2121
{
2222
public static function createAlreadyBlocked(BlockIdentity $identity): self
2323
{

tests/Functional/FilesystemTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Brainbits\Blocking\Tests\Functional;
1515

1616
use Brainbits\Blocking\Blocker;
17-
use Brainbits\Blocking\Exception\BlockFailedException;
17+
use Brainbits\Blocking\Exception\AlreadyBlockedException;
1818
use Brainbits\Blocking\Identity\BlockIdentity;
1919
use Brainbits\Blocking\Owner\ValueOwnerFactory;
2020
use Brainbits\Blocking\Storage\FilesystemStorage;
@@ -61,7 +61,7 @@ public function testSelfBlock(): void
6161

6262
public function testOtherBlock(): void
6363
{
64-
$this->expectException(BlockFailedException::class);
64+
$this->expectException(AlreadyBlockedException::class);
6565
$this->expectExceptionMessage('Identifier my_item is already blocked.');
6666

6767
file_put_contents(

tests/Functional/InMemoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
use Brainbits\Blocking\Block;
1717
use Brainbits\Blocking\Blocker;
18-
use Brainbits\Blocking\Exception\BlockFailedException;
18+
use Brainbits\Blocking\Exception\AlreadyBlockedException;
1919
use Brainbits\Blocking\Identity\BlockIdentity;
2020
use Brainbits\Blocking\Owner\Owner;
2121
use Brainbits\Blocking\Owner\ValueOwnerFactory;
@@ -56,7 +56,7 @@ public function testSelfBlock(): void
5656

5757
public function testOtherBlock(): void
5858
{
59-
$this->expectException(BlockFailedException::class);
59+
$this->expectException(AlreadyBlockedException::class);
6060
$this->expectExceptionMessage('Identifier my_item is already blocked.');
6161

6262
$storage = new InMemoryStorage($this->clock);

tests/Functional/PredisTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Brainbits\Blocking\Tests\Functional;
1515

1616
use Brainbits\Blocking\Blocker;
17-
use Brainbits\Blocking\Exception\BlockFailedException;
17+
use Brainbits\Blocking\Exception\AlreadyBlockedException;
1818
use Brainbits\Blocking\Identity\BlockIdentity;
1919
use Brainbits\Blocking\Owner\ValueOwnerFactory;
2020
use Brainbits\Blocking\Storage\PredisStorage;
@@ -67,7 +67,7 @@ public function testSelfBlock(): void
6767

6868
public function testOtherBlock(): void
6969
{
70-
$this->expectException(BlockFailedException::class);
70+
$this->expectException(AlreadyBlockedException::class);
7171
$this->expectExceptionMessage('Identifier my_item is already blocked.');
7272

7373
$this->client->set('block:my_item', json_encode(['identity' => 'my_item', 'owner' => 'other_owner']));

0 commit comments

Comments
 (0)