From 784209c8097b51c6dbfcd1c055cc035446166aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Thu, 27 Jun 2024 12:06:41 +0200 Subject: [PATCH 1/3] trait detection --- src/Actions/Action.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Actions/Action.php b/src/Actions/Action.php index 2ec3e3af..370a7e86 100644 --- a/src/Actions/Action.php +++ b/src/Actions/Action.php @@ -211,7 +211,7 @@ public function handleFormRequest(Request $request, Model $model): void $this->handle($request, $models); - if (in_array(HasRootEvents::class, class_uses_recursive($model))) { + if (method_exists($model, 'recordRootEvent')) { $models->each(static function (Model $model) use ($request): void { $model->recordRootEvent( Str::of(static::class)->classBasename()->headline()->value(), From 209c72c602023a6d4d7be4dd546e73942d4319f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Thu, 27 Jun 2024 12:17:03 +0200 Subject: [PATCH 2/3] Update Action.php --- src/Actions/Action.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Actions/Action.php b/src/Actions/Action.php index 370a7e86..ec35f412 100644 --- a/src/Actions/Action.php +++ b/src/Actions/Action.php @@ -211,8 +211,9 @@ public function handleFormRequest(Request $request, Model $model): void $this->handle($request, $models); - if (method_exists($model, 'recordRootEvent')) { + if (in_array(HasRootEvents::class, class_uses_recursive($model))) { $models->each(static function (Model $model) use ($request): void { + /** @phpstan-assert !null $model->recordRootEvent() */ $model->recordRootEvent( Str::of(static::class)->classBasename()->headline()->value(), $request->user() From 4d3e71a1585475955b6a32aab826de13c56e30d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Thu, 27 Jun 2024 12:20:23 +0200 Subject: [PATCH 3/3] Update Action.php --- src/Actions/Action.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Actions/Action.php b/src/Actions/Action.php index ec35f412..53b660ea 100644 --- a/src/Actions/Action.php +++ b/src/Actions/Action.php @@ -213,7 +213,7 @@ public function handleFormRequest(Request $request, Model $model): void if (in_array(HasRootEvents::class, class_uses_recursive($model))) { $models->each(static function (Model $model) use ($request): void { - /** @phpstan-assert !null $model->recordRootEvent() */ + /** @phpstan-assert \Cone\Root\Traits\HasRootEvents $model */ $model->recordRootEvent( Str::of(static::class)->classBasename()->headline()->value(), $request->user()