Skip to content

Commit 7dd103e

Browse files
committed
fix: Use ForType instead of For for attributes
Some linters (like PHPStan) are complaining about the `For` attribute since it's a reserved keyword. This commit renames the attribute to `ForType` to avoid this issue.
1 parent 22de83f commit 7dd103e

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

src/Infrastructure/InMemory/CommandBus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use GeekCell\Ddd\Contracts\Application\Command;
88
use GeekCell\Ddd\Contracts\Application\CommandBus as CommandBusInterface;
99
use GeekCell\Ddd\Contracts\Application\CommandHandler;
10-
use GeekCell\Ddd\Support\Attributes\For\Command as ForCommand;
10+
use GeekCell\Ddd\Support\Attributes\ForType\Command as ForCommand;
1111

1212
class CommandBus extends AbstractBus implements CommandBusInterface
1313
{

src/Infrastructure/InMemory/QueryBus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use GeekCell\Ddd\Contracts\Application\Query;
88
use GeekCell\Ddd\Contracts\Application\QueryBus as QueryBusInterface;
99
use GeekCell\Ddd\Contracts\Application\QueryHandler;
10-
use GeekCell\Ddd\Support\Attributes\For\Query as ForQuery;
10+
use GeekCell\Ddd\Support\Attributes\ForType\Query as ForQuery;
1111

1212
final class QueryBus extends AbstractBus implements QueryBusInterface
1313
{

src/Support/Attributes/For/Command.php renamed to src/Support/Attributes/ForType/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace GeekCell\Ddd\Support\Attributes\For;
5+
namespace GeekCell\Ddd\Support\Attributes\ForType;
66

77
use Attribute;
88
use GeekCell\Ddd\Contracts\Application\Command as CommandInterface;

src/Support/Attributes/For/Query.php renamed to src/Support/Attributes/ForType/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace GeekCell\Ddd\Support\Attributes\For;
5+
namespace GeekCell\Ddd\Support\Attributes\ForType;
66

77
use Attribute;
88
use GeekCell\Ddd\Contracts\Application\Query as QueryInterface;

tests/Infrastructure/InMemory/CommandBusTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use GeekCell\Ddd\Contracts\Application\Command;
88
use GeekCell\Ddd\Contracts\Application\CommandHandler;
99
use GeekCell\Ddd\Infrastructure\InMemory\CommandBus as InMemoryCommandBus;
10-
use GeekCell\Ddd\Support\Attributes\For;
10+
use GeekCell\Ddd\Support\Attributes\ForType;
1111
use PHPUnit\Framework\TestCase;
1212

1313
/**
@@ -27,7 +27,7 @@ class UnknownCommand implements Command
2727
/**
2828
* Test fixture for InMemoryCommandBus.
2929
*/
30-
#[For\Command(TestCommand::class)]
30+
#[ForType\Command(TestCommand::class)]
3131
class TestCommandHandler implements CommandHandler
3232
{
3333
public function execute(Command $command): mixed
@@ -39,7 +39,7 @@ public function execute(Command $command): mixed
3939
/**
4040
* Test fixture for InMemoryCommandBus.
4141
*/
42-
#[For\Command(TestCommand::class, 'handle')]
42+
#[ForType\Command(TestCommand::class, 'handle')]
4343
class TestCommandHandlerWithExplicitHandleMethod implements CommandHandler
4444
{
4545
public function handle(TestCommand $command): mixed
@@ -62,7 +62,7 @@ public function execute(Command $command): mixed
6262
/**
6363
* Test fixture for InMemoryCommandBus.
6464
*/
65-
#[For\Command(TestCommand::class)]
65+
#[ForType\Command(TestCommand::class)]
6666
class TestComamndHandlerWithoutExecuteMethod implements CommandHandler
6767
{
6868
}

tests/Infrastructure/InMemory/QueryBusTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use GeekCell\Ddd\Contracts\Application\Query;
88
use GeekCell\Ddd\Contracts\Application\QueryHandler;
99
use GeekCell\Ddd\Infrastructure\InMemory\QueryBus as InMemoryQueryBus;
10-
use GeekCell\Ddd\Support\Attributes\For;
10+
use GeekCell\Ddd\Support\Attributes\ForType;
1111
use PHPUnit\Framework\TestCase;
1212

1313
/**
@@ -27,7 +27,7 @@ class UnknownQuery implements Query
2727
/**
2828
* Test fixture for InMemoryQueryBus.
2929
*/
30-
#[For\Query(TestQuery::class)]
30+
#[ForType\Query(TestQuery::class)]
3131
class TestQueryHandler implements QueryHandler
3232
{
3333
public function execute(Query $query): mixed
@@ -39,7 +39,7 @@ public function execute(Query $query): mixed
3939
/**
4040
* Test fixture for InMemoryQueryBus.
4141
*/
42-
#[For\Query(TestQuery::class, 'handle')]
42+
#[ForType\Query(TestQuery::class, 'handle')]
4343
class TestQueryHandlerWithExplicitHandleMethod implements QueryHandler
4444
{
4545
public function handle(TestQuery $query): mixed
@@ -62,7 +62,7 @@ public function execute(Query $query): mixed
6262
/**
6363
* Test fixture for InMemoryCommandBus.
6464
*/
65-
#[For\Query(TestQuery::class)]
65+
#[ForType\Query(TestQuery::class)]
6666
class TestQueryHandlerWithoutExecuteMethod implements QueryHandler
6767
{
6868
}

0 commit comments

Comments
 (0)