Skip to content

Commit

Permalink
improve Closure phpdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Mar 27, 2024
1 parent 1a6f47f commit b8b507f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/UserAction/BasicExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<T of Model>($this, T): ?JsBlock JS expression to return if action was successful, e.g "new JsToast('Thank you')" */
protected $jsSuccess;

#[\Override]
Expand Down
4 changes: 2 additions & 2 deletions src/UserAction/ConfirmationExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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<T of Model>($this, T, mixed, mixed): ?JsBlock JS expression to return if action was successful, e.g "new JsToast('Thank you')" */
public $jsSuccess;

Check failure on line 33 in src/UserAction/ConfirmationExecutor.php

View workflow job for this annotation

GitHub Actions / Smoke (latest, StaticAnalysis)

PHPDoc tag @var template T of Closure<T of Atk4\Ui\UserAction\Model>($this, T, mixed, mixed): (Atk4\Ui\Js\JsBlock|null) has invalid bound type Atk4\Ui\UserAction\Model.

Check failure on line 33 in src/UserAction/ConfirmationExecutor.php

View workflow job for this annotation

GitHub Actions / Smoke (latest, StaticAnalysis)

Property Atk4\Ui\UserAction\ConfirmationExecutor::$jsSuccess has unknown class Atk4\Ui\UserAction\Model as its type.

Check failure on line 33 in src/UserAction/ConfirmationExecutor.php

View workflow job for this annotation

GitHub Actions / Smoke (latest, StaticAnalysis)

PHPDoc tag @var template T of Closure<T of Atk4\Ui\UserAction\Model>($this, T, mixed, mixed): (Atk4\Ui\Js\JsBlock|null) has invalid bound type Atk4\Ui\UserAction\Model.

Check failure on line 33 in src/UserAction/ConfirmationExecutor.php

View workflow job for this annotation

GitHub Actions / Smoke (latest, StaticAnalysis)

Property Atk4\Ui\UserAction\ConfirmationExecutor::$jsSuccess has unknown class Atk4\Ui\UserAction\Model as its type.

/** @var string CSS class for modal size. */
Expand Down Expand Up @@ -180,7 +180,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)

Check failure on line 183 in src/UserAction/ConfirmationExecutor.php

View workflow job for this annotation

GitHub Actions / Smoke (latest, StaticAnalysis)

Parameter #2 $ of closure expects Atk4\Ui\UserAction\Model, Atk4\Data\Model given.

Check failure on line 183 in src/UserAction/ConfirmationExecutor.php

View workflow job for this annotation

GitHub Actions / Smoke (latest, StaticAnalysis)

Parameter #2 $ of closure expects Atk4\Ui\UserAction\Model, Atk4\Data\Model given.
: $this->jsSuccess;

return new JsBlock([
Expand Down
2 changes: 1 addition & 1 deletion src/UserAction/JsCallbackExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<T of Model>($this, T, mixed, mixed): ?JsBlock JS expression to return if action was successful, e.g "new JsToast('Thank you')" */
public $jsSuccess;

#[\Override]
Expand Down
2 changes: 1 addition & 1 deletion src/UserAction/StepExecutorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<T of Model>($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. */
Expand Down

0 comments on commit b8b507f

Please sign in to comment.