Skip to content

Commit

Permalink
Refactor hook calls
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro committed Jan 24, 2024
1 parent 68b411e commit f4f57c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function __construct(
) {
}

public function __invoke(array $arguments, Context $context): Context
public function __invoke(array $arguments): mixed
{
return $context->addResult(call_user_func_array($this->callback, [...$arguments, $context]));
return call_user_func_array($this->callback, $arguments);
}
}
2 changes: 1 addition & 1 deletion src/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function run(string $name, array $arguments): Context
$context = new Context($data);

foreach ($this->getHooks($name) as $hook) {
$hook($arguments, $context);
$context->addResult($hook([...$arguments, $context]));

if ($context->should_stop_propagation) {
break;
Expand Down

0 comments on commit f4f57c9

Please sign in to comment.