Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagof committed Mar 15, 2024
2 parents 258ddff + b26523c commit 585c270
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Models/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
*/
class Action extends Element
{
use HasFactory;

/** @use BelongToRule<Action> */
use BelongToRule;

use HasFactory;

protected $table = 'volition_actions';

public function action(IsAction $action): static
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

class Condition extends Element
{
use HasFactory;

/** @use BelongToRule<Condition> */
use BelongToRule;

use HasFactory;

protected $table = 'volition_conditions';

public function condition(IsCondition $condition): static
Expand Down
6 changes: 3 additions & 3 deletions src/Traits/HasVolition.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function rule(string|Rule $rule): ?Rule
*
* @return Collection<\Squarebit\Volition\Contracts\IsAction>
*/
public function actions(string|Rule $forRule = null): Collection
public function actions(string|Rule|null $forRule = null): Collection
{
$actions = $forRule
? $this->rule($forRule)?->actions
Expand All @@ -60,7 +60,7 @@ public function actions(string|Rule $forRule = null): Collection
* @param class-string<TActionClass> $ofClass
* @return TActionClass|null
*/
public function action(string $ofClass, string $forRule = null, bool $throw = false): ?IsAction
public function action(string $ofClass, ?string $forRule = null, bool $throw = false): ?IsAction
{
$action = $this->actions($forRule)->firstWhere(fn (IsAction $action) => $action instanceof $ofClass);

Expand All @@ -76,7 +76,7 @@ public function action(string $ofClass, string $forRule = null, bool $throw = fa
/**
* @param class-string<\Squarebit\Volition\Contracts\IsAction> $actionClass
*/
public function executeAction(string $actionClass, string $forRule = null, bool $throw = false): mixed
public function executeAction(string $actionClass, ?string $forRule = null, bool $throw = false): mixed
{
return $this->action($actionClass, $forRule, $throw)?->execute($this);
}
Expand Down

0 comments on commit 585c270

Please sign in to comment.