Skip to content

Commit

Permalink
fix: Use ForType instead of For for attributes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
b00gizm committed Jan 20, 2023
1 parent 22de83f commit 7dd103e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Infrastructure/InMemory/CommandBus.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use GeekCell\Ddd\Contracts\Application\Command;
use GeekCell\Ddd\Contracts\Application\CommandBus as CommandBusInterface;
use GeekCell\Ddd\Contracts\Application\CommandHandler;
use GeekCell\Ddd\Support\Attributes\For\Command as ForCommand;
use GeekCell\Ddd\Support\Attributes\ForType\Command as ForCommand;

class CommandBus extends AbstractBus implements CommandBusInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Infrastructure/InMemory/QueryBus.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use GeekCell\Ddd\Contracts\Application\Query;
use GeekCell\Ddd\Contracts\Application\QueryBus as QueryBusInterface;
use GeekCell\Ddd\Contracts\Application\QueryHandler;
use GeekCell\Ddd\Support\Attributes\For\Query as ForQuery;
use GeekCell\Ddd\Support\Attributes\ForType\Query as ForQuery;

final class QueryBus extends AbstractBus implements QueryBusInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace GeekCell\Ddd\Support\Attributes\For;
namespace GeekCell\Ddd\Support\Attributes\ForType;

use Attribute;
use GeekCell\Ddd\Contracts\Application\Command as CommandInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace GeekCell\Ddd\Support\Attributes\For;
namespace GeekCell\Ddd\Support\Attributes\ForType;

use Attribute;
use GeekCell\Ddd\Contracts\Application\Query as QueryInterface;
Expand Down
8 changes: 4 additions & 4 deletions tests/Infrastructure/InMemory/CommandBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use GeekCell\Ddd\Contracts\Application\Command;
use GeekCell\Ddd\Contracts\Application\CommandHandler;
use GeekCell\Ddd\Infrastructure\InMemory\CommandBus as InMemoryCommandBus;
use GeekCell\Ddd\Support\Attributes\For;
use GeekCell\Ddd\Support\Attributes\ForType;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -27,7 +27,7 @@ class UnknownCommand implements Command
/**
* Test fixture for InMemoryCommandBus.
*/
#[For\Command(TestCommand::class)]
#[ForType\Command(TestCommand::class)]
class TestCommandHandler implements CommandHandler
{
public function execute(Command $command): mixed
Expand All @@ -39,7 +39,7 @@ public function execute(Command $command): mixed
/**
* Test fixture for InMemoryCommandBus.
*/
#[For\Command(TestCommand::class, 'handle')]
#[ForType\Command(TestCommand::class, 'handle')]
class TestCommandHandlerWithExplicitHandleMethod implements CommandHandler
{
public function handle(TestCommand $command): mixed
Expand All @@ -62,7 +62,7 @@ public function execute(Command $command): mixed
/**
* Test fixture for InMemoryCommandBus.
*/
#[For\Command(TestCommand::class)]
#[ForType\Command(TestCommand::class)]
class TestComamndHandlerWithoutExecuteMethod implements CommandHandler
{
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Infrastructure/InMemory/QueryBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use GeekCell\Ddd\Contracts\Application\Query;
use GeekCell\Ddd\Contracts\Application\QueryHandler;
use GeekCell\Ddd\Infrastructure\InMemory\QueryBus as InMemoryQueryBus;
use GeekCell\Ddd\Support\Attributes\For;
use GeekCell\Ddd\Support\Attributes\ForType;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -27,7 +27,7 @@ class UnknownQuery implements Query
/**
* Test fixture for InMemoryQueryBus.
*/
#[For\Query(TestQuery::class)]
#[ForType\Query(TestQuery::class)]
class TestQueryHandler implements QueryHandler
{
public function execute(Query $query): mixed
Expand All @@ -39,7 +39,7 @@ public function execute(Query $query): mixed
/**
* Test fixture for InMemoryQueryBus.
*/
#[For\Query(TestQuery::class, 'handle')]
#[ForType\Query(TestQuery::class, 'handle')]
class TestQueryHandlerWithExplicitHandleMethod implements QueryHandler
{
public function handle(TestQuery $query): mixed
Expand All @@ -62,7 +62,7 @@ public function execute(Query $query): mixed
/**
* Test fixture for InMemoryCommandBus.
*/
#[For\Query(TestQuery::class)]
#[ForType\Query(TestQuery::class)]
class TestQueryHandlerWithoutExecuteMethod implements QueryHandler
{
}
Expand Down

0 comments on commit 7dd103e

Please sign in to comment.