Skip to content

Commit 9745b28

Browse files
authored
refactor(commandbus)!: rename AsyncCommand to Async (#1507)
1 parent fd0912a commit 9745b28

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

docs/2-features/10-command-bus.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ final readonly class UserController()
8383
The asynchronous commands implementation of Tempest is currently experimental. Although you can use it, please note that it is not covered by our backwards compatibility promise.
8484
:::
8585

86-
A common use case for Tempest's command bus is to dispatch asynchronous commands: commands that are executed by their handler in the background, outside the main PHP process. Making a command asynchronous is done by adding the `#[AsyncCommand]` to your command object:
86+
A common use case for Tempest's command bus is to dispatch asynchronous commands: commands that are executed by their handler in the background, outside the main PHP process. Making a command asynchronous is done by adding the `#[Async]` to your command object:
8787

8888
```php
8989
// app/SendMail.php
9090

91-
use Tempest\CommandBus\AsyncCommand;
91+
use Tempest\CommandBus\Async;
9292

93-
#[AsyncCommand]
93+
#[Async]
9494
final readonly class SendMail
9595
{
9696
public function __construct(
@@ -100,7 +100,7 @@ final readonly class SendMail
100100
}
101101
```
102102

103-
Besides adding the `#[AsyncCommand]` attribute, the flow remains exactly the same as if you were dispatching synchronous commands:
103+
Besides adding the `#[Async]` attribute, the flow remains exactly the same as if you were dispatching synchronous commands:
104104

105105
```php
106106
use function Tempest\command;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
use Attribute;
88

99
#[Attribute]
10-
final readonly class AsyncCommand
10+
final readonly class Async
1111
{
1212
}

packages/command-bus/src/AsyncCommandMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __invoke(object $command, CommandBusMiddlewareCallable $next): v
2020
{
2121
$reflector = new ClassReflector($command);
2222

23-
if ($reflector->hasAttribute(AsyncCommand::class)) {
23+
if ($reflector->hasAttribute(Async::class)) {
2424
$this->repository->store(Random\uuid(), $command);
2525

2626
return;

tests/Integration/CommandBus/Fixtures/MyAsyncCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace Tests\Tempest\Integration\CommandBus\Fixtures;
66

7-
use Tempest\CommandBus\AsyncCommand;
7+
use Tempest\CommandBus\Async;
88

9-
#[AsyncCommand]
9+
#[Async]
1010
final readonly class MyAsyncCommand
1111
{
1212
public function __construct(

tests/Integration/CommandBus/Fixtures/MyFailingAsyncCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace Tests\Tempest\Integration\CommandBus\Fixtures;
66

7-
use Tempest\CommandBus\AsyncCommand;
7+
use Tempest\CommandBus\Async;
88

9-
#[AsyncCommand]
9+
#[Async]
1010
final readonly class MyFailingAsyncCommand
1111
{
1212
public function __construct(

0 commit comments

Comments
 (0)