Skip to content

Commit

Permalink
Merge pull request #352 from erikgaal/patch-1
Browse files Browse the repository at this point in the history
Exclude `tap` from possible handlers
  • Loading branch information
freekmurze authored Jul 14, 2022
2 parents ba15b5a + ff611b6 commit fef9af3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/AggregateRoots/AggregateRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function handleCommand(object $command): static
if ($handler = Handlers::new($this)
->public()
->protected()
->reject(fn (Method $method) => in_array($method->getName(), ['handleCommand', 'recordThat', 'apply']))
->reject(fn (Method $method) => in_array($method->getName(), ['handleCommand', 'recordThat', 'apply', 'tap']))
->accepts($command)
->first()
) {
Expand All @@ -85,7 +85,7 @@ public function handleCommand(object $command): static
$handler = Handlers::new($partial)
->public()
->protected()
->reject(fn (Method $method) => in_array($method->getName(), ['recordThat', 'apply']))
->reject(fn (Method $method) => in_array($method->getName(), ['recordThat', 'apply', 'tap']))
->accepts($command)
->first();

Expand Down Expand Up @@ -255,7 +255,7 @@ protected function apply(ShouldBeStored $event): void
Handlers::new($this)
->public()
->protected()
->reject(fn (Method $method) => in_array($method->getName(), ['handleCommand', 'recordThat', 'apply']))
->reject(fn (Method $method) => in_array($method->getName(), ['handleCommand', 'recordThat', 'apply', 'tap']))
->accepts($event)
->all()
->each(fn (Method $method) => $this->{$method->getName()}($event));
Expand Down

0 comments on commit fef9af3

Please sign in to comment.