diff --git a/src/AggregateRoots/AggregateRoot.php b/src/AggregateRoots/AggregateRoot.php index f7535937..0237d146 100644 --- a/src/AggregateRoots/AggregateRoot.php +++ b/src/AggregateRoots/AggregateRoot.php @@ -256,9 +256,11 @@ protected function apply(ShouldBeStored $event): void ->public() ->protected() ->reject(fn (Method $method) => in_array($method->getName(), ['handleCommand', 'recordThat', 'apply', 'tap'])) - ->acceptsTypes([$event::class]) + ->accepts($event) ->all() - ->each(fn (Method $method) => $this->{$method->getName()}($event)); + ->each(function (Method $method) use ($event) { + return $this->{$method->getName()}($event); + }); $this->appliedEvents[] = $event;