From 701161b0befea5cb84470a5a2d806c52389dff34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Wed, 27 Mar 2024 11:38:47 +0100 Subject: [PATCH] improve Closure phpdocs --- src/UserAction/BasicExecutor.php | 2 +- src/UserAction/ConfirmationExecutor.php | 5 +++-- src/UserAction/JsCallbackExecutor.php | 2 +- src/UserAction/StepExecutorTrait.php | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/UserAction/BasicExecutor.php b/src/UserAction/BasicExecutor.php index e41e349227..e3fa706b6a 100644 --- a/src/UserAction/BasicExecutor.php +++ b/src/UserAction/BasicExecutor.php @@ -45,7 +45,7 @@ class BasicExecutor extends View implements ExecutorInterface /** @var array list of validated arguments */ protected $validArguments = []; - /** @var JsExpressionable|\Closure JS expression to return if action was successful, e.g "new JsToast('Thank you')" */ + /** @var JsExpressionable|\Closure($this, T): ?JsBlock JS expression to return if action was successful, e.g "new JsToast('Thank you')" */ protected $jsSuccess; #[\Override] diff --git a/src/UserAction/ConfirmationExecutor.php b/src/UserAction/ConfirmationExecutor.php index 470b7cae21..b1d496e5e8 100644 --- a/src/UserAction/ConfirmationExecutor.php +++ b/src/UserAction/ConfirmationExecutor.php @@ -5,6 +5,7 @@ namespace Atk4\Ui\UserAction; use Atk4\Core\HookTrait; +use Atk4\Data\Model; use Atk4\Data\Model\UserAction; use Atk4\Ui\Button; use Atk4\Ui\Exception; @@ -29,7 +30,7 @@ class ConfirmationExecutor extends Modal implements JsExecutorInterface /** @var UserAction|null Action to execute */ public $action; - /** @var JsExpressionable|\Closure JS expression to return if action was successful, e.g "new JsToast('Thank you')" */ + /** @var JsExpressionable|\Closure($this, T, mixed, mixed): ?JsBlock JS expression to return if action was successful, e.g "new JsToast('Thank you')" */ public $jsSuccess; /** @var string CSS class for modal size. */ @@ -180,7 +181,7 @@ protected function doFinal(View $modal): void protected function jsGetExecute($obj, $id): JsBlock { $success = $this->jsSuccess instanceof \Closure - ? ($this->jsSuccess)($this, $this->action->getModel(), $id) + ? ($this->jsSuccess)($this, $this->action->getModel(), $id, $obj) : $this->jsSuccess; return new JsBlock([ diff --git a/src/UserAction/JsCallbackExecutor.php b/src/UserAction/JsCallbackExecutor.php index c016707d9f..0c346a61ec 100644 --- a/src/UserAction/JsCallbackExecutor.php +++ b/src/UserAction/JsCallbackExecutor.php @@ -34,7 +34,7 @@ class JsCallbackExecutor extends JsCallback implements ExecutorInterface /** @var Model\UserAction The model user action */ public $action; - /** @var JsExpressionable|\Closure JS expression to return if action was successful, e.g "new JsToast('Thank you')" */ + /** @var JsExpressionable|\Closure($this, T, mixed, mixed): ?JsBlock JS expression to return if action was successful, e.g "new JsToast('Thank you')" */ public $jsSuccess; #[\Override] diff --git a/src/UserAction/StepExecutorTrait.php b/src/UserAction/StepExecutorTrait.php index cdcdb365ae..340d0560fe 100644 --- a/src/UserAction/StepExecutorTrait.php +++ b/src/UserAction/StepExecutorTrait.php @@ -44,7 +44,7 @@ trait StepExecutorTrait /** @var bool */ protected $actionInitialized = false; - /** @var JsExpressionable|\Closure JS expression to return if action was successful, e.g "new JsToast('Thank you')" */ + /** @var JsExpressionable|\Closure($this, T, mixed, mixed): ?JsBlock JS expression to return if action was successful, e.g "new JsToast('Thank you')" */ public $jsSuccess; /** @var array A seed for creating form in order to edit arguments/fields user entry. */