diff --git a/composer.json b/composer.json index ffa8438c..968c44fd 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "illuminate/events": "^9.0", "illuminate/support": "^9.0", "phpdocumentor/reflection-docblock": "^5.2", - "spatie/better-types": "^0.1.0", + "spatie/better-types": "^0.1.2", "spatie/laravel-package-tools": "^1.9", "spatie/laravel-schemaless-attributes": "^2.0", "symfony/finder": "^6.0", diff --git a/src/AggregateRoots/AggregateRoot.php b/src/AggregateRoots/AggregateRoot.php index 513f0daa..f7535937 100644 --- a/src/AggregateRoots/AggregateRoot.php +++ b/src/AggregateRoots/AggregateRoot.php @@ -256,7 +256,7 @@ protected function apply(ShouldBeStored $event): void ->public() ->protected() ->reject(fn (Method $method) => in_array($method->getName(), ['handleCommand', 'recordThat', 'apply', 'tap'])) - ->accepts($event) + ->acceptsTypes([$event::class]) ->all() ->each(fn (Method $method) => $this->{$method->getName()}($event));